1#!/bin/bash
2#
3# ngIRCd -- The Next Generation IRC Daemon
4# Copyright (c)2001-2020 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
17gawk '
18  /^\[[[:digit:]]+:0 / {print "\033[1;95m" $0 "\033[0m"}
19  /^\[[[:digit:]]+:1 / {print "\033[1;35m" $0 "\033[0m"}
20  /^\[[[:digit:]]+:2 / {print "\033[1;91m" $0 "\033[0m"}
21  /^\[[[:digit:]]+:3 / {print "\033[1;31m" $0 "\033[0m"}
22  /^\[[[:digit:]]+:4 / {print "\033[1;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' </dev/stdin &
27
28wait
29