🔨 Add logger level to config

This commit is contained in:
Sebastien Clement 2021-01-05 10:36:44 +01:00
parent 57d0394dac
commit bdfecede62
3 changed files with 9 additions and 8 deletions

View File

@ -24,15 +24,10 @@
"hassio_role": "manager",
"homeassistant_api": true,
"options": {
"ssl": false,
"certfile": "fullchain.pem",
"keyfile": "privkey.pem"
"log_level": "info"
},
"schema": {
"log_level": "match(^(trace|debug|info|notice|warning|error|fatal)$)?",
"ssl": "bool",
"certfile": "str",
"keyfile": "str",
"leave_front_door_open": "bool?"
},
"ports": {

View File

@ -2,7 +2,7 @@ const appRoot = require("app-root-path");
const winston = require("winston");
const logger = winston.createLogger({
level: "debug",
level: process.env.LOG_LEVEL || 'info' ,
format: winston.format.combine(
winston.format.timestamp({
format: "YYYY-MM-DD HH:mm:ss",
@ -11,6 +11,7 @@ const logger = winston.createLogger({
// winston.format.splat(),
winston.format.colorize(),
winston.format.align(),
winston.format.printf(({ level, message, timestamp }) => {
return `[${timestamp}] [${level}]: ${message}`;
})

View File

@ -9,4 +9,9 @@
# ==============================================================================
cd /opt/nextcloud_backup/
npm start
if bashio::config.exists 'log_level'; then
LOG_LEVEL=$(bashio::config 'log_level')
else
LOG_LEVEL='info'
fi
LOG_LEVEL=$LOG_LEVEL npm start