Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
color-log gem: Colorizes the output of the standard library debug logger. http://blog.champierre.com/1064
Gem::Specification.new do |spec|
spec.name = "color-log"
spec.version = "0.0.1"
spec.authors = ["Junya Ishihara"]
spec.email = ["webmaster@champierre.com"]
spec.summary = "Colorizes the output of the standard library debug logger."
spec.files = ["color-log.rb"]
spec.require_path = "."
end
module ActiveSupport
class Logger < ::Logger
class SimpleFormatter < ::Logger::Formatter
def call_with_debug_colored(severity, timestamp, progname, msg)
if Rails.env.development? && severity == 'DEBUG'
"\033[33m#{call_without_debug_colored(severity, timestamp, progname, msg)}\033[0m"
else
call_without_debug_colored(severity, timestamp, progname, msg)
end
end
alias_method_chain :call, :debug_colored
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment