Last active
May 28, 2019 14:01
-
-
Save dehart/6db9b238b1f9b5580bcdedef20aa1a20 to your computer and use it in GitHub Desktop.
Log reader
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
#!/bin/bash | |
# $ chmod +x tailc | |
# $ tailc logs/debug.log | |
file=$1 | |
colors='function color(c,s) { printf("\033[%dm%s\033[0m\n",c,s) } | |
/[\w\/]+/ {color(35,$0);next} | |
/----/ {color(31,$0);next} | |
/(\[.*\])/ {color(32,$0);next} | |
{print " " $0}' | |
tail -1000f $file | awk "$colors" | |
# Colors | |
# 30 - black 34 - blue 40 - black 44 - blue | |
# 31 - red 35 - magenta 41 - red 45 - magenta | |
# 32 - green 36 - cyan 42 - green 46 - cyan | |
# 33 - yellow 37 - white 43 - yellow 47 - white |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment