2023-02-02 06:02:33 +00:00
|
|
|
const Logger = require('./logger');
|
|
|
|
const Config = require('./config').get;
|
|
|
|
|
|
|
|
// deps
|
|
|
|
const paths = require('path');
|
|
|
|
const bunyan = require('bunyan');
|
|
|
|
const { get } = require('lodash');
|
|
|
|
|
|
|
|
module.exports = class WebLog {
|
|
|
|
static createWebLog() {
|
|
|
|
const config = Config();
|
|
|
|
const logPath = config.paths.logs;
|
|
|
|
const rotatingFile = get(config, 'contentServers.web.logging.rotatingFile');
|
|
|
|
|
|
|
|
rotatingFile.path = paths.join(logPath, rotatingFile.fileName);
|
|
|
|
|
|
|
|
const serializers = Logger.standardSerializers();
|
|
|
|
serializers.req = bunyan.stdSerializers.req;
|
|
|
|
serializers.res = bunyan.stdSerializers.res;
|
|
|
|
|
|
|
|
const webLog = bunyan.createLogger({
|
2023-04-25 17:46:19 +00:00
|
|
|
name: 'ENiGMA½',
|
2023-02-02 06:02:33 +00:00
|
|
|
streams: [rotatingFile],
|
|
|
|
serializers,
|
|
|
|
});
|
|
|
|
|
|
|
|
return webLog;
|
|
|
|
}
|
|
|
|
};
|