Created
December 9, 2011 01:36
-
-
Save adparadise/1449695 to your computer and use it in GitHub Desktop.
A simple script to colorize logs piped through it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'term/ansicolor' | |
ARGF.each_line do |line| | |
color = case line | |
when /^ERROR/ then Term::ANSIColor.red | |
when /^WARN/ then Term::ANSIColor.yellow | |
when /^INFO/ then Term::ANSIColor.green | |
else "" | |
end | |
STDOUT.write(color + line + Term::ANSIColor.reset) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment