How can I colorize logger output in a rails 3 console
How can I color开发者_C百科ize and possibly bold the output from Rails.logger in my rails3 application?
Be kind to other programmers, don't embed the escape sequences directly in your strings. Maybe use a library like Rainbow or Term-ANSIColor? Eg Term-ANSIColor:
require 'term/ansicolor'
include Term::ANSIColor
Rails.logger.add 1, "#{red(ATCHUNG!)}: pay attention to me!"
How do I tell ActiveRecord not to log any control chars
just do the opposite, for active record
also see this link
http://joefiorini.com/post/64995867/coloring-in-the-rails-log-and-console
精彩评论