winstonjs / winston

A logger for just about everything.
http://github.com/winstonjs/winston
MIT License
22.57k stars 1.8k forks source link

[Bug]: logging emergency level with CLI format throw error #2232

Open Raffaello opened 1 year ago

Raffaello commented 1 year ago

🔎 Search Terms

emergency level with CLI

The problem

it throws:

"colors[Colorizer.allColors[lookup]] is not a function"

What version of Winston presents the issue?

v3.8.2

What version of Node are you using?

v16.13.2

If this worked in a previous version of Winston, which was it?

No response

Minimum Working Example

const logger = winston.createLogger({
      levels: winston.config.syslog.levels,
      "info",
    });
    logger.add(new winston.transports.Console());
    logger.format = winston.format.cli();

    logger.log("emergency", "test") // throws "colors[Colorizer.allColors[lookup]] is not a function"

Additional information

it looks like a missing lookup color for emergency syslog level in cli color format.

Raffaello commented 1 year ago

it looks like it also print undefined like a missing variable for these other levels:

  console.log

      notice:undefinedtest
      warning:undefinedtest
      alert:undefinedtest

there is also a warn and warning method, that is not clear which one is right or one is the alias of another.