class Cauchy::PrettyLogger

Public Class Methods

new(logger) click to toggle source
Calls superclass method
# File lib/cauchy/logging.rb, line 12
def initialize logger
  super

  old_formatter = logger.formatter

  logger.formatter =  proc do |level, time, prog, msg|
    unless msg.start_with?("\e")
      color = case level
              when 'FATAL' then :red
              when 'WARN'  then :yellow
              when 'INFO'  then :blue
              when 'DEBUG' then '333333'
              else              :default
              end
      msg = msg.color(color)
    end

    old_formatter.call level, time, prog, msg
  end
end

Public Instance Methods

inspect(object) click to toggle source
# File lib/cauchy/logging.rb, line 39
def inspect object
  info object.to_yaml[4..-1].strip.indent
end