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 thecolorspackage, 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?