]> arthur.barton.de Git - ngircd-alex.git/blob - contrib/nglog.sh
Add simple log colorization script: ./contrib/nglog.sh
[ngircd-alex.git] / contrib / nglog.sh
1 #!/bin/sh
2 #
3 # ngIRCd -- The Next Generation IRC Daemon
4 # Copyright (c)2001-2019 Alexander Barton (alex@barton.de) and Contributors
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 # Please read the file COPYING, README and AUTHORS for more information.
11 #
12 # This script parses the log output of ngircd(8), and colorizes the messages
13 # accoring to their log level. Example usage:
14 # ./src/ngircd/ngircd -f $PWD/doc/sample-ngircd.conf -np | ./contrib/nglog.sh
15 #
16
17 awk '
18   /^\[[[:digit:]]+:0 / {print "\033[95m" $0 "\033[0m"}
19   /^\[[[:digit:]]+:1 / {print "\033[35m" $0 "\033[0m"}
20   /^\[[[:digit:]]+:2 / {print "\033[91m" $0 "\033[0m"}
21   /^\[[[:digit:]]+:3 / {print "\033[31m" $0 "\033[0m"}
22   /^\[[[:digit:]]+:4 / {print "\033[33m" $0 "\033[0m"}
23   /^\[[[:digit:]]+:5 / {print "\033[1m" $0 "\033[0m"}
24   /^\[[[:digit:]]+:6 / {print $0}
25   /^\[[[:digit:]]+:7 / {print "\033[90m" $0 "\033[0m"}
26 '