pino icon indicating copy to clipboard operation
pino copied to clipboard

Accept log level env var as UPPER or LOWER case

Open filipeandre opened this issue 1 year ago • 4 comments

Currently it won't accept UPPER case log levels. But why "DEBUG" is invalid?

"DEBUG" should be as valid as "debug".

When setting level, please convert the input to lower case :)

filipeandre avatar Aug 05 '24 15:08 filipeandre

formatters: { level: (label) => {return { level: label.toUpperCase() }; }, },

The above snippet can help u transform log levels to uppercase.

balaji-buildx avatar Aug 19 '24 07:08 balaji-buildx

Would you like to send a Pull Request to address this issue? Remember to add unit tests.

jsumners avatar Aug 22 '24 10:08 jsumners

@jsumners i can take it up.

balaji-buildx avatar Aug 22 '24 11:08 balaji-buildx

@jsumners raised a PR. can u please check https://github.com/pinojs/pino/pull/2034 :)

balaji-buildx avatar Aug 23 '24 08:08 balaji-buildx

formatters: { level: (label) => {return { level: label.toUpperCase() }; }, },

@balaji-atoa any idea why this doesn't actually work? this is my config I'm passing to pino

pino({ formatters: { level(label) { return { level: label.toUpperCase() }; } }, level: 'debug', browser: { asObject: true }, });

output looks like image

elevatedbuttonpusher avatar Oct 01 '24 15:10 elevatedbuttonpusher

If you are using [email protected] or later, please open a new issue.

jsumners avatar Oct 02 '24 13:10 jsumners