summaryrefslogtreecommitdiff
path: root/lib/logging.js
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2022-03-15 03:56:59 +0300
committerEvgeny Zinoviev <me@ch1p.io>2022-03-15 03:56:59 +0300
commite075f11bdb1b194062d153cad181a6b04ad8fcfc (patch)
treefdadba7ab1c19c70cff5e247e173ad0bf939b8a6 /lib/logging.js
parent4f867d7cbcb7cd23b9cdfab3422bad9dc4a92415 (diff)
much fixes so improvementsHEADmaster
Diffstat (limited to 'lib/logging.js')
-rw-r--r--lib/logging.js35
1 files changed, 35 insertions, 0 deletions
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)
+ }
+}