-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogger.js
39 lines (35 loc) · 945 Bytes
/
logger.js
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
const fs = require('fs')
const sh = require('shelljs')
const root = '/data/log/'
sh.mkdir('-p',root)
var winston = require('winston');
require('winston-daily-rotate-file');
module.exports = function (name) {
var transport = new (winston.transports.DailyRotateFile)({
filename: root+'monitor-'+name+'-%DATE%.log',
datePattern: 'YYYY-MM-DD-HH',
zippedArchive: false,
maxSize: '20m',
maxFiles: '14d'
});
transport.on('rotate', function(oldfn, newfn) {
console.log('monitor page',oldfn,newfn)
});
return winston.createLogger({
transports: [ transport ]
});
}
/*
exports.write = function () {
transport = new (winston.transports.DailyRotateFile)({
filename: 'logs/monitor-web-%DATE%.log',
datePattern: 'YYYY-MM-DD-HH',
zippedArchive: false,
maxSize: '20m',
maxFiles: '14d'
});
transport.on('rotate', function(oldfn, newfn) {
console.log('monitor page',oldfn,newfn)
});
}
*/