From 23687d770de38a4baf145dae346ebf707558e6e2 Mon Sep 17 00:00:00 2001 From: Michael Dvorkin Date: Fri, 16 Dec 2011 13:24:14 -0800 Subject: [PATCH] Colorize logger.ap output in Rails if ActiveSupport::LogSubscriber.colorize_logging is set (which is on by default) --- lib/awesome_print/ext/active_support.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/awesome_print/ext/active_support.rb b/lib/awesome_print/ext/active_support.rb index 82e2122..7cce1f7 100644 --- a/lib/awesome_print/ext/active_support.rb +++ b/lib/awesome_print/ext/active_support.rb @@ -38,3 +38,10 @@ module AwesomePrint end AwesomePrint::Formatter.send(:include, AwesomePrint::ActiveSupport) +# +# Colorize Rails logs. +# +if defined?(ActiveSupport::LogSubscriber) + AwesomePrint.force_colors! ActiveSupport::LogSubscriber.colorize_logging +end +