1. Oben Sonne
  2. poole-obs

Commits

Oben Sonne  committed 4d5df9c

Draft: colog blog post

  • Participants
  • Parent commits 518853b
  • Branches default

Comments (0)

Files changed (3)

File input/blog/20120507-colorized-log-output.md

View file
  • Ignore whitespace
+title: blog
+post: Do your eyes a favor with colored log output
+date: 2012-05-07
+keywords: terminal, color, log output, log files
+description: A super simple solution to make log files more readable.
+---
+
+{{ pheader() }}
+
+*{{ page.description }}*
+
+## `cat messy.log` ... TL;DR
+
+<!--% image("colog-before.png", size=600, link="self") %-->
+
+## `cat messy.log | python colog.py` ... pleasure for your eyes
+
+<!--% image("colog-after.png", size=600, link="self") %-->
+
+A super simple Python script, ready for your customization. Usage examples
+follow.
+
+<script src="https://gist.github.com/2629510.js?file=colog.py"></script>
+
+## Examples
+
+### Watch log output from running programs
+
+    $ a-very-verbose-program 2>&1 | python colog.py
+
+### Watch a log file with `tail`
+
+    $ tail -f /path/to/some/logfile | python colog.py
+
+### Read a log file colored in `less`
+
+    $ cat /path/to/some/logfile | python colog.py | less -FRS
+
+## Need more?
+
+If this simple solution does not solve your log file reading problems, have a
+try with a more powerful solution like [MultiTail][].
+
+
+<!--{ pfooter }-->
+
+[dvcs]: http://en.wikipedia.org/w/index.php?title=Distributed_Version_Control_System
+[mercurial]: http://mercurial.selenic.com
+[qso]: http://stackoverflow.com/q/4329230/151299
+[multitail]: http://www.vanheusden.com/multitail/

File input/images.raw/colog-after.png

  • Ignore whitespace
Added
New image

File input/images.raw/colog-before.png

  • Ignore whitespace
Added
New image