test.js
708 Bytes
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
var winston = require('winston');
var tk = require('timekeeper');
require('./index.js');
var transport = new (winston.transports.DailyRotateFile)({
filename: 'log',
datePattern: 'yyyy-MM-dd.',
prepend: true,
level: process.env.ENV === 'development' ? 'debug' : 'info',
maxDays: 10,
json: false,
maxFiles: 5,
maxsize: 10485760
});
var logger = new (winston.Logger)({
transports: [
transport
]
});
var time = new Date();
var logEntry = function (x) {
if (x < 21) {
time.setDate(x);
tk.travel(time);
logger.info('hello world', function (err) {
if (err) {
console.log(err);
}
console.log(x);
logEntry(x + 1);
});
}
};
logEntry(5);