E
E
eewynell2020-06-09 02:20:57
Node.js
eewynell, 2020-06-09 02:20:57

Why does winston output undefined?

let winston = require("winston");

let logger = winston.createLogger({
    format: {
        transform(info, opts) {
            info.message = "!" + info.message + "!";
            return info;
        }
    },
    transports: [
        new winston.transports.Console()
    ]
});

logger.info("Something");

The code outputs "undefined". Why is this happening?
When choosing built-in formats, everything works fine. But when I write my own, or even paste the format from the examples from the official winston documentation, then no.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question