Simple tool to highlight and graph text files, especially log files like text log analyzer.
- filter lines to include or exclude by text match
- colorize words or colorize whole line with text match
- create simple binary graph, based on START and END text match
Print only lines with text ERROR and WARNING but exclude with text "open file" and "close file" (like grep
or grep -v
to exclude)
$ highlight -i ERROR -i WARNING -e "open file" -e "close file"
Colorize lines to red
containing text ERROR
, to yellow
with WARNING
$ highlight -l r ERROR -l y WARNING
Colorize word socket.read
to blue
socket.write to pink
.
$ highlight -w b socket.read -l p socket.write
Create vertical graph line with cyan
character C
where start is with text connection.lock
and stops with connection.unlock
and yellow
G
starting gate open
ending gate close
$ highlight -g c C connection.lock connection.unlock -g y G "gate open" "gate close"

- k black
- r red
- y yellow
- g green
- c cyan
- b blue
- m magenta
- p pink
- w white
- gr gray
- lr lred
- ly lyellow
- lg lgreen
- lc lcyan
- lb lblue
- lm lmagenta
- lp lpink
- lw lwhite
- foreground lr lred
- :background :g :green
- foreground:background w:b white:blue
$ highlight --help
usage: highlight.py [-h] [-i MATCH] [-e MATCH] [-l COLOR MATCH] [-w COLOR MATCH] [-g COLOR CHAR MATCH_START MATCH_END] [files ...]
positional arguments:
files file names, or pipe
options:
-h, --help show this help message and exit
-i MATCH, --include MATCH
include lines with match
-e MATCH, --exclude MATCH
exclude lines with match
-l COLOR MATCH, --line COLOR MATCH
colorize line with match
-w COLOR MATCH, --word COLOR MATCH
colorize match
-g COLOR CHAR MATCH_START MATCH_END, --graph COLOR CHAR MATCH_START MATCH_END
draw vertical binary graph on left side
pip install git+/~https://github.com/pavelrevak/highlight.git
pip uninstall log-highlighter