Winston logger appends "undefined" to every log entry

Viewed 2244

In a node.js / express.js - based application the winston logging framework (version 2.4.0) is used for logging. That works fine, except that undefined is appended to every log output. The type of output (string, object, ..) does not change that behaviour. Winston is used from several .js files like this:

const logger = require('winston')
..
logger.info(`Handled request in ${Date.now() - start}ms.`);

The output for the above log statement is:

info: Handled request in 667ms.undefined

When logger.{info|debug|..} is replaced with a statement that logs to console the output is as expected; just the statement(s) to be logged with the 'undefined' concatenated at the end.

What might be the cause?

1 Answers
Related