diff options
author | Sam Stephenson <sam@37signals.com> | 2005-10-15 15:34:09 +0000 |
---|---|---|
committer | Sam Stephenson <sam@37signals.com> | 2005-10-15 15:34:09 +0000 |
commit | 10714869dcf1b86eccfc230629a9842e36996996 (patch) | |
tree | 057c7c8ca8385c67c2f40d7cde61025f26db14b0 | |
parent | 8cfcc04d08860dcff16a97901acc1538e4cf6e20 (diff) | |
download | rails-10714869dcf1b86eccfc230629a9842e36996996.tar.gz rails-10714869dcf1b86eccfc230629a9842e36996996.tar.bz2 rails-10714869dcf1b86eccfc230629a9842e36996996.zip |
Change default logging colors to work on both white and black backgrounds.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2614 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | activerecord/CHANGELOG | 3 | ||||
-rwxr-xr-x | activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | 13 |
2 files changed, 10 insertions, 6 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 7fc4162bcc..908548d536 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,4 +1,7 @@ *SVN* + +* Change default logging colors to work on both white and black backgrounds. [Sam Stephenson] + * YAML fixtures support ordered hashes for fixtures with foreign key dependencies in the same table. #1896 [purestorm@ggnore.net] * :dependent now accepts :nullify option. Sets the foreign key of the related objects to NULL instead of deleting them. #2015 [Robby Russell <robby@planetargon.com>] diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index 29382a3933..c04b6b96ff 100755 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -81,15 +81,16 @@ module ActiveRecord def format_log_entry(message, dump = nil) if ActiveRecord::Base.colorize_logging - if @@row_even then - @@row_even = false; caller_color = "1;32"; message_color = "4;33"; dump_color = "1;37" + if @@row_even + @@row_even = false + message_color, dump_color = "4;36;1", "0;1" else - @@row_even = true; caller_color = "1;36"; message_color = "4;35"; dump_color = "0;37" + @@row_even = true + message_color, dump_color = "4;35;1", "0" 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 = " \e[#{message_color}m#{message}\e[0m " + log_entry << "\e[#{dump_color}m%#{String === dump ? 's' : 'p'}\e[0m" % dump if dump log_entry else "%s %s" % [message, dump] |