johann philipp strathausen

berlin based indie maker

Pipe heroku logs in colour

Just a little trick of the day to leverage your fancy colour monitor when piping heroku logs around.

Fire your editor at file /usr/local/heroku/lib/heroku/helpers/log_displayer.rb and somewhere at line 20, remove the condition that says

if STDOUT.isatty && ENV.has_key?("TERM")
  display(colorize(chunk))
else
  display(chunk)
end

and change it to something like this

display(colorize(chunk))

Make sure you don’t use the heroku logs anywhere else, as this modification will break stuff.

You may also want to modify the other occurence of the same condition a few lines further down to

heroku logs --app nodecload -t|sed 's/2[^ ]* //'

Enjoy a happier life.