get line number and filename for a log output
问题 Is it possible to get the line number and file for each log output ? For example: var winston = require('winston'); winston.log('info', 'some message!'); // this is at line 4 of myfile.js should specify in log file that 'some message' came from myFile.js line 4. 回答1: You can pass the file name as label and you can get the file name from callingModule. Create logger.js file and code like var winston = require('winston'); var getLabel = function (callingModule) { var parts = callingModule