Skip to content

Instantly share code, notes, and snippets.

@dale3h
Created April 19, 2018 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dale3h/3a147106c32a6a3c927306d5d1040b49 to your computer and use it in GitHub Desktop.
Save dale3h/3a147106c32a6a3c927306d5d1040b49 to your computer and use it in GitHub Desktop.
[Hass.io] Colored Log Viewer for Home Assistant
#!/bin/bash
################################################################
## @usage clog folder_watcher=magenta,system_log=red
## @colors https://www.npmjs.com/package/colors#text-colors
## @license MIT
## @author Dale Higgs <@dale3h>
################################################################
[[ -n "$(command -v apk)" ]] \
|| { echo "[ERROR] could not find apk"; exit 1; }
[[ -n "$(command -v npm)" ]] \
|| { echo "[INFO] installing npm..."; apk add nodejs; } \
|| { echo "[ERROR] could not install npm"; exit 1; }
[[ -n "$(command -v color-logviewer)" ]] \
|| { echo "[INFO] installing color-logviewer..."; npm install -g color-logviewer; } \
|| { echo "[ERROR] could not install color-logviewer"; exit 1; }
colors=
[[ -n "$CLOG_COLORS" ]] && colors="$colors$CLOG_COLORS,"
[[ -n "$1" ]] && colors="$colors$1,"
clear
color-logviewer -c ${colors}ERROR=red,WARN=yellow,INFO=green,DEBUG=cyan,TRACE=blue /config/home-assistant.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment