Script for viewing the serial log in glorious technicolor
This commit is contained in:
parent
0659cf73f6
commit
0f5445da62
25
toolchain/colortail
Executable file
25
toolchain/colortail
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
function ce()
|
||||
{
|
||||
echo -e "${@}"
|
||||
}
|
||||
|
||||
red="\x1b[31m"
|
||||
yellow="\x1b[33m"
|
||||
green="\x1b[32m"
|
||||
blue="\x1b[34m"
|
||||
normal="\x1b[0m"
|
||||
|
||||
function colorize()
|
||||
{
|
||||
echo "$1" | sed \
|
||||
-e "s/^\[INFO\]/\[$(ce $blue)INFO$(ce $normal)\]/" \
|
||||
-e "s/^\[OK\]/\[$(ce $green)OK$(ce $normal)\]/" \
|
||||
-e "s/^\[WARNING\]/\[$(ce $yellow)WARNING$(ce $normal)\]/" \
|
||||
-e "s/^\[ERROR\]/\[$(ce $red)ERROR$(ce $normal)\]/"
|
||||
}
|
||||
|
||||
tail -f $1 | while read line; do
|
||||
colorize "$line"
|
||||
done
|
Loading…
x
Reference in New Issue
Block a user