~adigitoleo/clr

ANSI log colorizer
Update README
Update todo list
Use TXR not hare lang

refs

main
browse  log 

clone

read-only
https://git.sr.ht/~adigitoleo/clr
read/write
git@git.sr.ht:~adigitoleo/clr

You can also use your local clone with git send-email.

#clr

ANSI log colorizer, written in TXR lang. Will be rewritten in Tab lang.

Alpha release todo:

  • [ ] rewrite in tab lang (faster, simpler lang), https://tab-lang.xyz/
  • [ ] use inotify and/or polling to provide an -F option like less -F
  • [ ] colorize file paths/names and line numbers: /path/to/foo.c:42

#Goals

  • Timestamp/date detection, in a wide variety of formats
  • Coloring should be utomatic, with minimal or no configuration
  • Repetetive pattern detecion (e.g. 'kern.info', 'user.info' in syslog)
  • Detect a small set of keywords like 'crit[ical]:', 'warn[ing]:' 'err[or]:'
  • Detect various common "continuation" signifiers e.g. '... ' or indented lines
  • It should only use base 8 ANSI colors and maybe a boldface/emphasis switch

#Non-goals

  • Extensive rules/plugins system
  • Removing ANSI codes (reverse operation); see ansifilter

#Other colorizers

My searches lead me to a mythical program called colorize written by one Gergely Nagy for FreeBSD, for which I have only managed to find an online manual page. It isn't packaged by my Linux distribution and I don't know where the sources are, so I cannot make any comparisons here.

The program CCZE was written as a replacement for colorize in almost 5,000 lines of C excluding comments. It has rules, plugins, etc. If we become like CCZE, that is a problem.

The more recent grc aims for a broader scope, beyond a simple syslog colorizer. It can inject ANSI codes in the output of numerous GNU/Linux commands, again using a comprehensive configuration system. Although featureful and more actively maintained than the last two options, it refuses to read from stdin and therefore cannot be used in pipes. Awkward usage is combined with a confusing split into grc and grcat executables.

There is also clog, from the taskwarrior project, which seems to have some extremely basic rules for syslog coloring.

Supercat is perhaps the most interesting alternative, and offers HTML output capability, if that is something you want.