Skip to content

Commit

Permalink
chore(log): prefix logs with colored service name (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thom-x authored Feb 22, 2022
1 parent 4679f7a commit 9dbee2a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion root/etc/services.d/dump1090/run
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ then
then
/bin/nc ${RTL_TCP_REMOTE_HOST} ${RTL_TCP_REMOTE_PORT} | /usr/lib/fr24/dump1090 --net --write-json /usr/lib/fr24/public_html/data --raw --quiet --lat ${HTML_SITE_LAT} --lon ${HTML_SITE_LON} ${DUMP1090_ADDITIONAL_ARGS} --ifile -
else
/usr/lib/fr24/dump1090 --net --write-json /usr/lib/fr24/public_html/data --raw --quiet --lat ${HTML_SITE_LAT} --lon ${HTML_SITE_LON} ${DUMP1090_ADDITIONAL_ARGS}
/usr/lib/fr24/dump1090 --net --write-json /usr/lib/fr24/public_html/data --raw --quiet --lat ${HTML_SITE_LAT} --lon ${HTML_SITE_LON} ${DUMP1090_ADDITIONAL_ARGS} 2>&1 | stdbuf -o0 sed --unbuffered '/^$/d' | mawk -W interactive '{printf "%c[31m [dump1090]%c[0m " $0 "\n", 27, 27}'
# stdbuf ... -- (remove blank lines from output)
# awk -W interactive ... (prefix log messages with color and "[dump1090]")
fi
else
tail -f /dev/null
Expand Down
4 changes: 3 additions & 1 deletion root/etc/services.d/fr24feed/run
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/usr/bin/with-contenv bash
if [ "$SERVICE_ENABLE_FR24FEED" != "false" ]
then
/fr24feed/fr24feed/fr24feed
/fr24feed/fr24feed/fr24feed 2>&1 | stdbuf -o0 sed --unbuffered '/^$/d' | mawk -W interactive '{printf "%c[34m [fr24feed]%c[0m " $0 "\n", 27, 27}'
# stdbuf ... -- (remove blank lines from output)
# awk -W interactive ... (prefix log messages with color and "[fr24feed]")
else
tail -f /dev/null
fi
4 changes: 3 additions & 1 deletion root/etc/services.d/http/run
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
if [ "$SERVICE_ENABLE_HTTP" != "false" ]
then
cd /usr/lib/fr24/public_html
/usr/bin/python3 -m http.server 8080
/usr/bin/python3 -m http.server 8080 2>&1 | stdbuf -o0 sed --unbuffered '/^$/d' | mawk -W interactive '{printf "%c[32m [http]%c[0m " $0 "\n", 27, 27}'
# stdbuf ... -- (remove blank lines from output)
# awk -W interactive ... (prefix log messages with color and "[http]")
else
tail -f /dev/null
fi
4 changes: 3 additions & 1 deletion root/etc/services.d/piaware/run
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/usr/bin/with-contenv bash
if [ "$SERVICE_ENABLE_PIAWARE" != "false" ]
then
/usr/bin/piaware -plainlog
/usr/bin/piaware -plainlog 2>&1 | stdbuf -o0 sed --unbuffered '/^$/d' | mawk -W interactive '{printf "%c[33m [piaware]%c[0m " $0 "\n", 27, 27}'
# stdbuf ... -- (remove blank lines from output)
# awk -W interactive ... (prefix log messages with color and "[piaware]")
else
tail -f /dev/null
fi

0 comments on commit 9dbee2a

Please sign in to comment.