Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. const winston = require('winston');
  2. require('winston-daily-rotate-file');
  3.  
  4. var transport = new (winston.transports.DailyRotateFile)({
  5. filename: 'application-%DATE%.log',
  6. datePattern: 'YYYY-MM-DD-HH',
  7. zippedArchive: true,
  8. maxSize: '20m',
  9. maxFiles: '14d',
  10. format: winston.format.combine(
  11. winston.format.timestamp(),
  12. winston.format.json()
  13. )
  14. });
  15.  
  16. transport.on('rotate', function(oldFilename, newFilename) {
  17. // do something fun
  18. });
  19.  
  20. var logger = winston.createLogger({
  21. transports: [
  22. transport
  23. ]
  24. });
  25.  
  26. logger.info('Hello World!');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement