bbb-webrtc-sfu now rotates logs daily
This commit is contained in:
parent
281a14baf8
commit
5e384e2d4a
@ -17,4 +17,3 @@ to-audio: "to-audio-sfu"
|
||||
log:
|
||||
filename: '/var/log/bigbluebutton/bbb-webrtc-sfu/bbb-webrtc-sfu.log'
|
||||
level: 'verbose'
|
||||
maxSize: 100000000
|
||||
|
@ -1,17 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Logger singleton for mcs-sip
|
||||
* @memberof mcs-sip
|
||||
*/
|
||||
|
||||
const Winston = require('winston');
|
||||
const Logger = new Winston.Logger();
|
||||
const config = require('config');
|
||||
const path = require('path');
|
||||
Winston.transports.DailyRotateFile = require('winston-daily-rotate-file');
|
||||
|
||||
const LOG_CONFIG = config.get('log') || {};
|
||||
const { level } = LOG_CONFIG;
|
||||
let filename = LOG_CONFIG.filename;
|
||||
|
||||
Logger.configure({
|
||||
levels: { error: 0, warn: 1, info: 2, verbose: 3, debug: 4 },
|
||||
@ -31,22 +28,20 @@ Logger.add(Winston.transports.Console, {
|
||||
colorize: true,
|
||||
handleExceptions: false,
|
||||
silent: false,
|
||||
stringify: (obj) => JSON.stringify(obj)
|
||||
stringify: (obj) => JSON.stringify(obj),
|
||||
level,
|
||||
});
|
||||
|
||||
let filename = LOG_CONFIG.filename || path.join(process.env.PWD, 'mcs-sip.log');
|
||||
|
||||
if (filename) {
|
||||
Logger.add(Winston.transports.File, {
|
||||
Logger.add(Winston.transports.DailyRotateFile, {
|
||||
filename,
|
||||
prettyPrint: true,
|
||||
timestamp:true,
|
||||
datePattern: '.yyyy-dd-MM',
|
||||
prepend: false,
|
||||
stringify: (obj) => JSON.stringify(obj), // single lines
|
||||
maxsize: LOG_CONFIG.maxSize || '100000000' // 100MB default
|
||||
level,
|
||||
});
|
||||
}
|
||||
|
||||
Logger.transports.console.level = LOG_CONFIG.level;
|
||||
Logger.transports.file.level = LOG_CONFIG.level;
|
||||
|
||||
module.exports = Logger;
|
||||
|
23
labs/bbb-webrtc-sfu/package-lock.json
generated
23
labs/bbb-webrtc-sfu/package-lock.json
generated
@ -225,6 +225,21 @@
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
|
||||
},
|
||||
"mkdirp": {
|
||||
"version": "0.5.1",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
|
||||
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
},
|
||||
"dependencies": {
|
||||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
|
||||
}
|
||||
}
|
||||
},
|
||||
"moment": {
|
||||
"version": "2.20.1",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.20.1.tgz",
|
||||
@ -403,6 +418,14 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"winston-daily-rotate-file": {
|
||||
"version": "1.7.2",
|
||||
"resolved": "https://registry.npmjs.org/winston-daily-rotate-file/-/winston-daily-rotate-file-1.7.2.tgz",
|
||||
"integrity": "sha1-ZQK/opeCT9mC2l5WR8dThXjS+aA=",
|
||||
"requires": {
|
||||
"mkdirp": "0.5.1"
|
||||
}
|
||||
},
|
||||
"ws": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-3.3.2.tgz",
|
||||
|
@ -15,7 +15,8 @@
|
||||
"ws": "^3.3.2",
|
||||
"config": "^1.26.1",
|
||||
"js-yaml": "^3.8.3",
|
||||
"winston": "^2.4.0"
|
||||
"winston": "^2.4.0",
|
||||
"winston-daily-rotate-file": "^1.7.2"
|
||||
},
|
||||
"optionalDependencies": {}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user