diff options
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract_adapter.rb')
-rwxr-xr-x | activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index d686d71246..b0865d9aab 100755 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -422,16 +422,20 @@ module ActiveRecord end def format_log_entry(message, dump = nil) - if @@row_even then - @@row_even = false; caller_color = "1;32"; message_color = "4;33"; dump_color = "1;37" + if ActiveRecord::Base.colorize_logging + if @@row_even then + @@row_even = false; caller_color = "1;32"; message_color = "4;33"; dump_color = "1;37" + else + @@row_even = true; caller_color = "1;36"; message_color = "4;35"; dump_color = "0;37" + end + + log_entry = " \e[#{message_color}m#{message}\e[m" + log_entry << " \e[#{dump_color}m%s\e[m" % dump if dump.kind_of?(String) && !dump.nil? + log_entry << " \e[#{dump_color}m%p\e[m" % dump if !dump.kind_of?(String) && !dump.nil? + log_entry else - @@row_even = true; caller_color = "1;36"; message_color = "4;35"; dump_color = "0;37" + "%s %s" % [message, dump] end - - log_entry = " \e[#{message_color}m#{message}\e[m" - log_entry << " \e[#{dump_color}m%s\e[m" % dump if dump.kind_of?(String) && !dump.nil? - log_entry << " \e[#{dump_color}m%p\e[m" % dump if !dump.kind_of?(String) && !dump.nil? - log_entry end end |