From e075f11bdb1b194062d153cad181a6b04ad8fcfc Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Tue, 15 Mar 2022 03:56:59 +0300 Subject: much fixes so improvements --- lib/logging.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 lib/logging.js (limited to 'lib/logging.js') diff --git a/lib/logging.js b/lib/logging.js new file mode 100644 index 0000000..bca6eb6 --- /dev/null +++ b/lib/logging.js @@ -0,0 +1,35 @@ +const log4js = require('log4js') + +module.exports = { + configure(verbose) { + const categories = { + default: { + appenders: ['stdout-filter'], + level: 'trace' + } + } + const appenders = { + stdout: { + type: 'stdout', + level: 'warn' + }, + 'stdout-filter': { + type: 'logLevelFilter', + appender: 'stdout', + level: verbose ? 'debug' : 'warn' + } + } + log4js.configure({ + appenders, + categories + }) + }, + + getLogger(...args) { + return log4js.getLogger(...args) + }, + + shutdown(cb) { + log4js.shutdown(cb) + } +} -- cgit v1.2.3