1
0
mirror of https://github.com/osmarks/ngircd.git synced 2024-12-12 01:40:27 +00:00

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
This commit is contained in:
Alexander Barton 2019-11-10 22:07:26 +01:00
parent de1de40551
commit 80437b2533
3 changed files with 30 additions and 1 deletions

View File

@ -233,6 +233,7 @@
FAA3D28B0F139D2E00B2447E /* preinstall.sh */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.script.sh; path = preinstall.sh; sourceTree = "<group>"; }; FAA3D28B0F139D2E00B2447E /* preinstall.sh */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.script.sh; path = preinstall.sh; sourceTree = "<group>"; };
FAA97C55124A271400D5BBA9 /* sighandlers.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = sighandlers.c; sourceTree = "<group>"; }; FAA97C55124A271400D5BBA9 /* sighandlers.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = sighandlers.c; sourceTree = "<group>"; };
FAA97C56124A271400D5BBA9 /* sighandlers.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = sighandlers.h; sourceTree = "<group>"; }; FAA97C56124A271400D5BBA9 /* sighandlers.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = sighandlers.h; sourceTree = "<group>"; };
FAA9C8162377186900A04296 /* nglog.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = nglog.sh; sourceTree = "<group>"; };
FAACD5F314A6099C006ED74F /* class.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = class.c; sourceTree = "<group>"; }; FAACD5F314A6099C006ED74F /* class.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = class.c; sourceTree = "<group>"; };
FAACD5F414A6099C006ED74F /* class.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = class.h; sourceTree = "<group>"; }; FAACD5F414A6099C006ED74F /* class.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = class.h; sourceTree = "<group>"; };
FAD5852F15271A7800328741 /* Capabilities.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = Capabilities.txt; sourceTree = "<group>"; }; FAD5852F15271A7800328741 /* Capabilities.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = Capabilities.txt; sourceTree = "<group>"; };
@ -483,6 +484,7 @@
FA322D940CEF7523001761B3 /* ngircd.spec */, FA322D940CEF7523001761B3 /* ngircd.spec */,
FA4B08E813E7F91C00765BA3 /* platformtest.sh */, FA4B08E813E7F91C00765BA3 /* platformtest.sh */,
FA322D960CEF7523001761B3 /* systrace.policy */, FA322D960CEF7523001761B3 /* systrace.policy */,
FAA9C8162377186900A04296 /* nglog.sh */,
); );
name = contrib; name = contrib;
path = ..; path = ..;

View File

@ -1,6 +1,6 @@
# #
# ngIRCd -- The Next Generation IRC Daemon # ngIRCd -- The Next Generation IRC Daemon
# Copyright (c)2001-2017 Alexander Barton (alex@barton.de) and Contributors # Copyright (c)2001-2019 Alexander Barton (alex@barton.de) and Contributors
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -20,6 +20,7 @@ EXTRA_DIST = README \
ngircd.service \ ngircd.service \
ngircd.socket \ ngircd.socket \
ngircd.spec \ ngircd.spec \
nglog.sh \
platformtest.sh \ platformtest.sh \
systrace.policy systrace.policy

26
contrib/nglog.sh Executable file
View File

@ -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"}
'