views:

171

answers:

2

How can I colorize and possibly bold the output from Rails.logger in my rails3 application?

+1  A: 

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!"
jdeseno