Winston logger names

The Winston Iron Logging Library is quite useful, but I can't figure out how to name registrars. I expect output similar to other log libraries, for example:

 [<date>] [<log level>] <logger name> - <the message>

Can Winston be configured this way?

Thank.

+5
source share
3 answers

When creating a logging transport, you can provide a parameter labelthat will be added to the log output between the log level and the log message. For instance:

var logger = new (winston.Logger)({
    transports: [
        new (winston.transports.Console)({
            colorize: true,
            prettyPrint: true,
            timestamp: true,
            label: 'CustomLabel'
        })
    ]
});

This will lead to the following conclusion:

2016-09-06T12:16:17.335Z - info: [CustomLabel] hello
+8
source

You can name a logig ; however, there seems to be no way to add the log name to the output.

, . open pull, , "" , , , .

0

https://github.com/mcclellanmj/SimplyLog is based on the fact that you can easily code your own applications with user output and center around the named loggers.

-1
source

All Articles