javascript - Correct logging to file using Node.js's Winston module -


i'm using winston logging both console , file. if specify formatter , logged message same previous one, file log written once. in other situations (no formatter specified or writing console) logging works expected.

here's simplified code:

var winston = require('winston');  function formatter(args) {     return "some formatting: " + args.message; }  var weirdlogger = new (winston.logger)({     transports: [         new (winston.transports.console)({             json: false,             formatter: formatter         }),         new (winston.transports.file)({             filename: "weirdlogger.csv",             json: false,             formatter: formatter         })     ] });  var workinglogger = new (winston.logger)({     transports: [         new (winston.transports.console)({             json: false         }),         new (winston.transports.file)({             filename: "workinglogger.csv",             json: false         })     ] });  var weirdlogtest = function () {     weirdlogger.info("test1");     workinglogger.info("test2"); };  var expectedbehaviorlogtest = function () {     weirdlogger.info("test1: " + new date().gettime());     workinglogger.info("test2: " + new date().gettime()); };  setinterval(weirdlogtest, 5000); //setinterval(expectedbehaviorlogtest, 5000); 

as written, code shows test1 , test2 being logged console every 5 seconds , workinglogger.csv being updated, weirdlogger.csv not. commenting out setinterval(weirdlogtest, 5000); , commenting in expectedbehavior test shows logging happens expected when date appended each log.

i've been unable find in docs ignoring duplicate messages or other things explain this. ideas i'm doing incorrectly? bug, don't want rule out user error.

this confirmed bug caused not formatter because formatted log output short. there fix merged.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -