prysm - log file colorizer


"I can write a log file colorizer in less than 100 lines."

Demian L. Neidetcher


synopsis

prysm is an excruciatingly simple log file colorizer implemented in Python.

the itch that i am scratching is log file blindness. there are certain log file events that are of great importance. putting a bunch of characters or newlines in logging doesn't always get your attention and when it's too obnoxious you have to go in and remove it from your regular logging. with prysm you can set up rules to define the color (foreground and background) specific lines will be displayed.

of interest might be things like opening and closing database connections, different error levels (like in log4j DEBUG, ERROR, etc..), exceptions being thrown in code or like on my example i have it configured to display light blue (cyan) whenever someone accesses my resume.

i heard about a colorizer implemented in Perl but i would sooner write code in Emacs as i would depend on something written in Perl for my personal productivity; after all i'm a professional (antagonist).

here's a screeny in all it's glory...

download

prysm is the actual program, color.rules is just a sample of the rules you'll need to set up

instructions

  1. find yourself an operating system that does not suck. i actually have run it on cygwin if the man insists on keeping you down.
  2. you need to have Python installed
  3. put prysm somewhere in your path
  4. edit the color.rules file how you want it, the program does not use regular expression just plain old string matching. the sample color.rules file is very self-explainitory
  5. place the color.rules file in the same directory that you are going to be viewing the log files in
  6. prysm takes input from standard in so you need to pipe output from a 'tail -f' to prysm, like this
    tail -f log.file | prysm
  7. it's doing an endless loop waiting for more input from 'tail -f' so if you want to stop you need to press control-z

license

GNU General Public License

Prysm is a colorizer implemented in Python. Using a configuration file you can specify strings that will be highlighted by the program. This is helpful for highlighting specific entries for logging.

Copyright (C) 2002 Demian L. Neidetcher

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

possible enhancements

SourceForge Logo