winstonjs/winston

Winston 3.0.0-rc1 feedback

Open

#1159 opened on Nov 30, 2017

View on GitHub
 (5 comments) (0 reactions) (0 assignees)JavaScript (21,967 stars) (1,789 forks)batch import
Feature RequestGood First IssueHelp Wanted

Description

I’ve been looking for the right logging library, and I think this is it!

I have just one complaint: I would like more built-in control over colorization.

I just started using winston this morning, so please forgive me if I’m missing something. But as far as I can tell, calling winston.format.colorize() only colorizes the level and/or message properties.

I am using the following format:

    winston.format.combine(
            winston.format.label({ 'label': `[${label}]` }),
            winston.format.colorize(),
            colorizeLabel(),
            winston.format.printf( 
                (info) => { return `${info.label} ${info.level} ${info.message}` } 
            )
    )

I wanted to be able to tell winston.format.colorize() that I wanted to add color to info.label.

  • After reading up on winston.format, I had to go to winstonjs/logform and read up.
  • After reading the README, I couldn’t find the info I needed, so I started reading the source code of colorize.js.
  • It turned out that logform’s colorize() function uses the colors package, so I had to go to a third place and read about how that works.
  • Finally, I had to write a small custom function (colorizeLabel), and insert it into the formatting “pipeline”.

This was (uncharacteristically) tedious. Everything else about Winston is very easy, and very well-documented. (THANK YOU for such great documentation!)

I would love to be able to pass options to colorize() that allow me to map colors to whatever pieces of the info object I want.

Is this possible, say, before the official release of v3.0.0?

Contributor guide