Open davelowndes opened 3 months ago
Environment: winston 3.13.0 Windows 11 node v20.5.1
If I use format inside new winston.transports.Console() the Error is undefined:
format
new winston.transports.Console()
undefined
import winston from 'winston' const logger = winston.createLogger({ transports: [new winston.transports.Console()], format: winston.format.printf((info) => { return `${info.level}: ${info.message}` }) }) const logger2 = winston.createLogger({ transports: [new winston.transports.Console({ format: winston.format.printf((info) => { return `${info.level}: ${info.message}` }) } )], }) logger.info('test') logger2.info('test') try { throw new Error('oh no!') } catch (err) { logger.error(err) logger2.error(err) }
Output:
info: test info: test error: oh no! error: undefined
Environment: winston 3.13.0 Windows 11 node v20.5.1
If I use
format
insidenew winston.transports.Console()
the Error isundefined
:Output: