class Jekyll::LogAdapter
Constants
- LOG_LEVELS
Attributes
Public Class Methods
Public: Create a new instance of Jekyll's log writer
writer - Logger compatible instance log_level - (optional, symbol) the log level
Returns nothing
# File lib/jekyll/log_adapter.rb, line 18 def initialize(writer, level = :info) @writer = writer self.log_level = level end
Public Instance Methods
Public: Print a Jekyll error message and immediately abort the process
topic - the topic of the message, e.g. “Configuration file”, “Deprecation”, etc. message - the message detail (can be omitted)
Returns nothing
# File lib/jekyll/log_adapter.rb, line 78 def abort_with(topic, message = nil) error(topic, message) abort end
Public: Print a jekyll debug message
topic - the topic of the message, e.g. “Configuration file”, “Deprecation”, etc. message - the message detail
Returns nothing
# File lib/jekyll/log_adapter.rb, line 38 def debug(topic, message = nil) writer.debug(message(topic, message)) end
Public: Print a jekyll error message
topic - the topic of the message, e.g. “Configuration file”, “Deprecation”, etc. message - the message detail
Returns nothing
# File lib/jekyll/log_adapter.rb, line 68 def error(topic, message = nil) writer.error(message(topic, message)) end
Internal: Format the topic
topic - the topic of the message, e.g. “Configuration file”, “Deprecation”, etc.
Returns the formatted topic statement
# File lib/jekyll/log_adapter.rb, line 98 def formatted_topic(topic) "#{topic} ".rjust(20) end
Public: Print a jekyll message
topic - the topic of the message, e.g. “Configuration file”, “Deprecation”, etc. message - the message detail
Returns nothing
# File lib/jekyll/log_adapter.rb, line 48 def info(topic, message = nil) writer.info(message(topic, message)) end
Public: Set the log level on the writer
level - (symbol) the log level
Returns nothing
# File lib/jekyll/log_adapter.rb, line 28 def log_level=(level) writer.level = LOG_LEVELS.fetch(level) end
Internal: Build a Jekyll topic method
topic - the topic of the message, e.g. “Configuration file”, “Deprecation”, etc. message - the message detail
Returns the formatted message
# File lib/jekyll/log_adapter.rb, line 89 def message(topic, message) formatted_topic(topic) + message.to_s.gsub(/\s+/, ' ') end
Public: Print a jekyll message
topic - the topic of the message, e.g. “Configuration file”, “Deprecation”, etc. message - the message detail
Returns nothing
# File lib/jekyll/log_adapter.rb, line 58 def warn(topic, message = nil) writer.warn(message(topic, message)) end