winston version?_winston@2winston@3 node -v outputs:_ v9.5.0The following code does not log the Error object, but just:
{"level":"error","message":{},"timestamp":"2018-08-03T13:38:21.376Z"}
const winston = require('winston');
const logger = winston.createLogger({
level: 'info',
transports: [
new winston.transports.Console({
format: winston.format.combine(winston.format.timestamp(), winston.format.json())
})
]
});
logger.log({ level: 'error', message: new Error("Yo, it's on fire") });
I experimented with custom formatters:
winston.format.printf(info => `${info.timestamp} [ ${info.level} ] ${info.message}`)
which logs the Error message, but there's still no stack trace.
Coming from Winston@2, I'd expect this to log the Error object including a stack trace.
I have the same problem. I use winston-mongodb, and in 'meta' property in database I see level and error message, but not error object.
+1
Same problem here.
Error object gives undefined
still not fixed :confused:
Valid concerns! There is a nice workaround by @SamuelMaddox17 / @indexzero in #1338 , but we should do something so this works more out-of-the-box. Let's track this issue in #1338 since it's the same thing. Thanks all!