More colorful logging with ANSI color codes - Papertrail Blog

The revolution will be verbosely {,b}logged

More colorful logging with ANSI color codes

Posted by Troy Davis on

Papertrail’s event viewer now honors ANSI color codes in log messages. Here’s an example:

image

The light blue and purple colors were chosen by the application which generated these logs (Ruby on Rails) and are embedded in the log messages. The messages contain ANSI color codes. These escape characters can set the foreground color, background color, and treatment (such as bold) for sections of the message.

This is live now. To use it, simply change your framework or app’s the logging configuration in your Web framework or custom app logs to generate colorized logs. Colors will be shown in Papertrail automatically.

Papertrail already automatically colorizes the orange sender name and blue program name, since they are links to show related context (see Event Viewer Intro).

Finally, a word of caution: it’s easy to go overboard here. A tiny, tiny bit of color goes a long way.

Please send any comments (or screenshots!) and enjoy.