Winston logger.info is not a function
I installed Winston with MySQL transport and console and put it in a module called logger
. So ...
// modules/logger.js
/* require statements */
exports.logger = new (winston.Logger)({
transports: [
new winstonMysql(winstonMysqlConfig),
new (winston.transports.Console)
]
});
And then in /modules
// modules/index.js
/* grab other modules */
exports.logger = require('./logger.js');
When I do console.log(modules.logger)
I get this
{ logger:
EventEmitter {
...
error: [Function],
warn: [Function],
info: [Function],
verbose: [Function],
debug: [Function],
silly: [Function],
...
}
}
But when I call modules.logger.info()
it throws an error modules.logger.info is not a function
. What's wrong?
+3
source to share