-
Notifications
You must be signed in to change notification settings - Fork 146
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
Feature request: support POWERTOOLS_LOG_LEVEL
environmental variable
#1353
Comments
Hi @nateiler 👋 Thank you for using Powertools Logger and opening this issue. It is safe to use lowercase values for log levels, look at the type definition and method responsible for log level setup. So you can set For the proposal part, we should wait for the response from maintainers and thumbs-ups from the users. Have a nice day! |
Ah, I should have dug a little deeper into the code. Thanks for pointing that out! |
Hi @nateiler, thank you for opening the issue. As @shdq also pointed out (thx!), you can now use both uppercase & lowercase versions of all log levels. This is a new feature that was launched in With this in mind, I would like to put the feature request temporarily on hold with the goal to understand if there's demand for this type of change. I do see your point about consistency, and after looking at the Powertools toolkit in other versions I found out that Python uses the same as us ( Personally, while I see the argument about consistency and scoping, I think In the meanwhile, as a stop gap solution until an agreement has been reached, people who want to use non standard variable names can still do so, and then handle in their code the translation (although it's not the most elegant/ergonomic): const logLevel = process.env.MY_CUSTOM_LOG_LEVEL_VARIABLE || 'INFO';
const logger = new Logger({ logLevel }); |
POWERTOOLS_LOG_LEVEL
environmental variable
|
Use case
We were transitioning some lambdas from logging with Pino to Powertools and encountered a conflict when setting the
LOG_LEVEL
constant.When setting the
LOG_LEVEL
constant to 'WARN', Pino would throw an error as it would expectwarn
.Solution/User Experience
I'm proposing
POWERTOOLS_LOG_LEVEL
is added. It aligns w/ the other environment naming conventions yet allows for specific targeting for AWS Powertools without any side effects.The current
LOG_LEVEL
would remain, butPOWERTOOLS_LOG_LEVEL
would take precedence if present.Alternative solutions
No response
Acknowledgment
Future readers
Please react with 👍 and your use case to help us understand customer demand.
The text was updated successfully, but these errors were encountered: