Permalink
Browse files

Change default logging colors to work on both white and black backgro…

…unds.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2614 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 8cfcc04 commit 10714869dcf1b86eccfc230629a9842e36996996 @sstephenson sstephenson committed Oct 15, 2005
Showing with 10 additions and 6 deletions.
  1. +3 −0 activerecord/CHANGELOG
  2. +7 −6 activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
View
@@ -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>]
@@ -81,15 +81,16 @@ def log_info(sql, name, runtime)
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]

0 comments on commit 1071486

Please sign in to comment.