Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept log level env var as UPPER or LOWER case #2022

Closed
filipeandre opened this issue Aug 5, 2024 · 6 comments
Closed

Accept log level env var as UPPER or LOWER case #2022

filipeandre opened this issue Aug 5, 2024 · 6 comments

Comments

@filipeandre
Copy link

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 :)

@balaji-atoa
Copy link
Contributor

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

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

@jsumners
Copy link
Member

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

@balaji-atoa
Copy link
Contributor

@jsumners i can take it up.

@balaji-atoa
Copy link
Contributor

@jsumners raised a PR. can u please check #2034 :)

@elevatedbuttonpusher
Copy link

elevatedbuttonpusher commented Oct 1, 2024

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

@jsumners
Copy link
Member

jsumners commented Oct 2, 2024

If you are using pino@9.4.0 or later, please open a new issue.

@jsumners jsumners closed this as completed Oct 2, 2024
@pinojs pinojs locked as resolved and limited conversation to collaborators Oct 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants