Added logger-setup-module

f_influx-checks
Ruakij 3 years ago
parent 8ee189f52b
commit cc8b106157

@ -0,0 +1,11 @@
const log4js = require("log4js");
function setup(category = "unknown"){
const logger = log4js.getLogger(category);
logger.level = process.env.LOGLEVEL ?? "INFO";
return logger;
}
// Specify exports
module.exports = setup;

@ -1,15 +1,13 @@
const log4js = require("log4js");
const logger = require("./helper/logger.js")("main");
const { requireEnvVars } = require("./helper/env.js");
const { exit } = require("process");
/// Setup logger
const logger = log4js.getLogger("main");
logger.level = process.env.LOGLEVEL ?? "INFO";
/// Setup ENVs
const env = process.env;
// Defaults
{
env.LOGLEVEL ??= "INFO";
env.WIFI_INTERFACE ??= "wlan0";
env.WIFI_CHANNEL ??= [1,6,11];
env.WIFI_CHANNEL_TIME ??= 1;

Loading…
Cancel
Save