Created
December 6, 2022 18:43
-
-
Save ppdouble/e0ebcb77cebd3201d3e843f7ffc65ffc to your computer and use it in GitHub Desktop.
Highlight log information using awk. Match format like: xxxx [debug] xxxxx xxxx xxxx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
black=30m | |
red=31m | |
green=32m | |
yellow=33m | |
blue=34m | |
magenta=35m | |
cyan=36m | |
white=37m | |
blacklog="\"\033[$black\" \$0 \"\033[39m\"" | |
redlog="\"\033[$red\" \$0 \"\033[39m\"" | |
greenlog="\"\033[$green\" \$0 \"\033[39m\"" | |
yellowlog="\"\033[$yellow\" \$0 \"\033[39m\"" | |
bluelog="\"\033[$blue\" \$0 \"\033[39m\"" | |
magentalog="\"\033[$magenta\" \$0 \"\033[39m\"" | |
cyanlog="\"\033[$cyan\" \$0 \"\033[39m\"" | |
whitelog="\"\033[$white\" \$0 \"\033[39m\"" | |
trace="/\[trace\]/ {print $redlog}" | |
debug="/\[debug\]/ {print $magentalog}" | |
info="/\[info\]/ {print $greenlog}" | |
warning="/\[warning\]/ {print $bluelog}" | |
error="/\[error\]/ {print $yellowlog}" | |
command | awk "$trace $debug $info $warning $error" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment