TypeError: winston.Logger is not a constructor with winston and morgan
As you mention, you are using 3.0.0
, you can not not use winston.Logger
, you may refer library code( https://github.com/winstonjs/winston/blob/master/lib/winston.js#L178 )
You need to make small update in your code, use winston.createLogger
instead of new (winston.Logger)
// your centralized logger object
let logger = winston.createLogger({
transports: [
new (winston.transports.Console)(options.console),
new (winston.transports.File)(options.errorFile),
new (winston.transports.File)(options.file)
],
exitOnError: false, // do not exit on handled exceptions
});