While coloring of what ActiveRecord produces in logs definately helps
readability and I like it as much as you do, I think those who develop
on Windows (and don't use Cygwin) shouldn't be doomed to manually
disabling it in each and every development instance:

config.active_record.colorize_logging = false

Of course, this is better (more portable):
config.active_record.colorize_logging = false if RUBY_PLATFORM =~ /mswin32/

But the issue here isn't configurability, but defaults. People who
wrote ActiveRecord long ago chose to roll with something proprietary
to shells (ANSI coloring codes) and enabled it by default while
ensuring it can always be disabled. That's great, but if a feature
doesn't make sense on a platform, it should be disabled by default on
the same. My proposal is to change a line in ActiveRecord base.rb:

    cattr_accessor :colorize_logging
-    @@colorize_logging = true
+    @@colorize_logging = RUBY_PLATFORM.index('mswin').nil?

This is certainly not the most semantically beautiful line you've seen
- it would be the first place to use RUBY_PLATFORM in Rails except in
Railties and ActiveSupport Kernel extensions - but it may be the right
thing to do. Putting a connection adapter in charge of pretty-printing
log entries is not the most correct thing in the world, either, but
it's still there :)

I've felt I have to bring this up here because I knew if I submit a
ticket to Trac it would not get that much attention due to its nature.

Thanks for listening,
-Mislav

p.s. this doesn't affect Cygwin installs; they can still enjoy coloring...
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to