Parent

Files

Jekyll::Stevenson

Constants

DEBUG
ERROR
INFO
WARN

Attributes

log_level[RW]

Public Class Methods

new(level = INFO) click to toggle source

Public: Create a new instance of Stevenson, Jekyll's logger

level - (optional, integer) the log level

Returns nothing

# File lib/jekyll/stevenson.rb, line 15
def initialize(level = INFO)
  @log_level = level
end

Public Instance Methods

error(topic, message) click to toggle source

Public: Print a jekyll error message to stderr

topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc. message - the message detail

Returns nothing

# File lib/jekyll/stevenson.rb, line 45
def error(topic, message)
  $stderr.puts(message(topic, message).red) if log_level <= ERROR
end
formatted_topic(topic) click to toggle source

Public: Format the topic

topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.

Returns the formatted topic statement

# File lib/jekyll/stevenson.rb, line 64
def formatted_topic(topic)
  "#{topic} ".rjust(20)
end
info(topic, message) click to toggle source

Public: Print a jekyll message to stdout

topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc. message - the message detail

Returns nothing

# File lib/jekyll/stevenson.rb, line 25
def info(topic, message)
  $stdout.puts(message(topic, message)) if log_level <= INFO
end
message(topic, message) click to toggle source

Public: 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/stevenson.rb, line 55
def message(topic, message)
  formatted_topic(topic) + message.gsub(/\s+/, ' ')
end
warn(topic, message) click to toggle source

Public: Print a jekyll message to stderr

topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc. message - the message detail

Returns nothing

# File lib/jekyll/stevenson.rb, line 35
def warn(topic, message)
  $stderr.puts(message(topic, message).yellow) if log_level <= WARN
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.