test.js 708 Bytes
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);