From 0f5445da62e79450cec9b00664d63f51cf0e0287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Lov=C3=A9n?= Date: Thu, 7 Dec 2017 21:43:18 +0100 Subject: [PATCH] Script for viewing the serial log in glorious technicolor --- toolchain/colortail | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 toolchain/colortail diff --git a/toolchain/colortail b/toolchain/colortail new file mode 100755 index 0000000..b35d897 --- /dev/null +++ b/toolchain/colortail @@ -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