add extended logging feats

This commit is contained in:
joBr99
2023-11-26 12:14:15 +01:00
parent bc3d58d406
commit 900e1aef46
4 changed files with 26 additions and 16 deletions

View File

@@ -1,6 +1,6 @@
# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config
name: NSPanel Lovelace UI Addon
version: "4.7.41"
version: "4.7.43"
slug: nspanel-lovelace-ui
description: NSPanel Lovelace UI Addon
services:
@@ -17,7 +17,16 @@ init: false
map:
- addon_config:rw
options:
message: "Hello world..."
loglevel:
- DEBUG
- INFO
- WARNING
- ERROR
- CRITICAL
logtofile:
- true
- false
schema:
message: "str?"
loglevel: list(DEBUG|INFO|WARNING|ERROR|CRITICAL)
logtofile: bool
image: "ghcr.io/jobr99/{arch}-nspanel-lovelace-ui"

View File

@@ -7,7 +7,7 @@ declare exit_code
readonly exit_code_container=$(</run/s6-linux-init-container-results/exitcode)
readonly exit_code_service="${1}"
readonly exit_code_signal="${2}"
readonly service="AppDaemon"
readonly service="NsPanel Lovelace UI MQTT Manager"
bashio::log.info \
"Service ${service} exited with code ${exit_code_service}" \

View File

@@ -4,16 +4,5 @@
# s6-overlay docs: https://github.com/just-containers/s6-overlay
# ==============================================================================
# Add your code here
# Declare variables
declare message
## Get the 'message' key from the user config options.
message=$(bashio::config 'message')
## Print the message the user supplied, defaults to "Hello World..."
bashio::log.info "${message:="Hello World..."}"
## Run your program
exec /usr/bin/mqtt-manager/run.sh

View File

@@ -14,4 +14,16 @@ if test -f "$CONFIG_FILE"; then
else
cp /usr/bin/mqtt-manager/panels.yaml.example $CONFIG_FILE
fi
python /usr/bin/mqtt-manager/main.py
declare LOGLEVEL
declare logtofile
LOGLEVEL=$(bashio::config 'loglevel')
logtofile=$(bashio::config 'logtofile')
export LOGLEVEL
if [[ "$logtofile" == "true" ]]; then
python /usr/bin/mqtt-manager/main.py 2>&1 | tee /config/out.log
else
python /usr/bin/mqtt-manager/main.py
fi