summary refs log tree commit diff
path: root/contrib/nglog.sh
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2019-11-10 22:07:26 +0100
committerAlexander Barton <alex@barton.de>2019-11-10 22:07:26 +0100
commit80437b253377fdd19274d974eb8ccc248ac7beb0 (patch)
treef61d79d6b081879fd848ddba9390c4047788eca2 /contrib/nglog.sh
parentde1de4055123e95fd9dc1b7e40c69a760777079d (diff)
downloadngircd-80437b253377fdd19274d974eb8ccc248ac7beb0.tar.gz
ngircd-80437b253377fdd19274d974eb8ccc248ac7beb0.zip
Add simple log colorization script: ./contrib/nglog.sh
This script parses the log output of ngircd(8), and colorizes the
messages accoring to their log level. Example usage:

ngircd -f $PWD/doc/sample-ngircd.conf -np | ./contrib/nglog.sh
Diffstat (limited to 'contrib/nglog.sh')
-rwxr-xr-xcontrib/nglog.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/contrib/nglog.sh b/contrib/nglog.sh
new file mode 100755
index 00000000..001570a5
--- /dev/null
+++ b/contrib/nglog.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# ngIRCd -- The Next Generation IRC Daemon
+# Copyright (c)2001-2019 Alexander Barton (alex@barton.de) and Contributors
+#
+# 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.
+# Please read the file COPYING, README and AUTHORS for more information.
+#
+# This script parses the log output of ngircd(8), and colorizes the messages
+# accoring to their log level. Example usage:
+# ./src/ngircd/ngircd -f $PWD/doc/sample-ngircd.conf -np | ./contrib/nglog.sh
+#
+
+awk '
+  /^\[[[:digit:]]+:0 / {print "\033[95m" $0 "\033[0m"}
+  /^\[[[:digit:]]+:1 / {print "\033[35m" $0 "\033[0m"}
+  /^\[[[:digit:]]+:2 / {print "\033[91m" $0 "\033[0m"}
+  /^\[[[:digit:]]+:3 / {print "\033[31m" $0 "\033[0m"}
+  /^\[[[:digit:]]+:4 / {print "\033[33m" $0 "\033[0m"}
+  /^\[[[:digit:]]+:5 / {print "\033[1m" $0 "\033[0m"}
+  /^\[[[:digit:]]+:6 / {print $0}
+  /^\[[[:digit:]]+:7 / {print "\033[90m" $0 "\033[0m"}
+'