mirror of
https://github.com/github/rails.git
synced 2026-04-04 03:00:58 -04:00
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
This commit is contained in:
@@ -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 @@ 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]
|
||||
|
||||
Reference in New Issue
Block a user