Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x | 'use strict'
const path = require('path')
const bunyan = require('bunyan')
const fse = require('fs-extra');
const config = require('../config/env')
fse.ensureDirSync(path.join(config.root, 'logs/'))
const logger = bunyan.createLogger({
name: config.appName,
serializers: {
req: bunyan.stdSerializers.req,
res: bunyan.stdSerializers.res,
err: bunyan.stdSerializers.err,
},
streams: [{
level: 'info',
stream: process.stdout,
}, {
level: 'trace',
stream: process.stdout,
}, {
level: 'debug',
stream: process.stderr,
}, {
type: 'rotating-file',
level: 'error',
path: path.join(config.root, `logs/${config.env}-error.log`),
period: '1d', // daily rotation
count: 7, // keep 7 back copies
}],
})
logger.tag = function (option) {
Eif (typeof option === 'string') {
option = { tag: option };
}
return logger.child(option);
};
module.exports = logger |