Sha256: 06b9934323a708815f4a20b6826dc0e0d7d3265d079f0292197deef821247b4c

Contents?: true

Size: 1.48 KB

Versions: 3

Compression:

Stored size: 1.48 KB

Contents

require 'logger'

module Jekyll
  class Logger < Logger
    # 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
    def self.info(topic, message)
      $stdout.puts message(topic, message)
    end

    # 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
    def self.warn(topic, message)
      $stderr.puts message(topic, message).yellow
    end

    # 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
    def self.error(topic, message)
      $stderr.puts message(topic, message).red
    end

    # 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
    def self.message(topic, message)
       formatted_topic(topic) + message.gsub(/\s+/, ' ')
    end

    # Public: Format the topic
    #
    # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
    #
    # Returns the formatted topic statement
    def self.formatted_topic(topic)
      "#{topic} ".rjust(20)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jekyll-1.0.2 lib/jekyll/logger.rb
jekyll-1.0.1 lib/jekyll/logger.rb
jekyll-1.0.0 lib/jekyll/logger.rb