Skip to content

Instantly share code, notes, and snippets.

@thbar
Created March 10, 2017 16:05
Show Gist options
  • Select an option

  • Save thbar/eaca5c5f2da8d327f6b44457670ef4d6 to your computer and use it in GitHub Desktop.

Select an option

Save thbar/eaca5c5f2da8d327f6b44457670ef4d6 to your computer and use it in GitHub Desktop.
A way to log errors in red with Ruby's Logger & the colorize gem
source 'https://rubygems.org'
gem 'colorize'
require 'logger'
require 'colorized_string'
class ColorLogger < Logger
def error(message)
super(ColorizedString[message].colorize(:red))
end
end
logger = ColorLogger.new(STDOUT)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment