rswolff
rswolff

Reputation: 3328

How can I colorize logger output in a rails 3 console

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

Upvotes: 3

Views: 2733

Answers (2)

user324312
user324312

Reputation:

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

Upvotes: 7

Related Questions