You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the docs, we should be able to set the log level explicitly through the level parameter to Logger.
Current Behaviour
The level parameter is properly set the first time you instantiate Logger, but subsequent instantiations with the same service name will not set the log level. (It will always be the original value from the first instance.)
Code snippet
fromaws_lambda_powertoolsimportLoggerfirst=Logger(level="INFO")
second=Logger(level="DEBUG")
print(f"first level = {first.log_level}") # first level = 20print(f"second level = {second.log_level}") # second level = 20. (Should be 10)
Possible Solution
In Logger._init_logger, setLevel should be called before the early return.
Steps to Reproduce
Run the following code:
fromaws_lambda_powertoolsimportLoggerfirst=Logger(level="INFO")
second=Logger(level="DEBUG")
print(f"first level = {first.log_level}") # first level = 20print(f"second level = {second.log_level}") # second level = 20. (Should be 10)
Powertools for AWS Lambda (Python) version
latest
AWS Lambda function runtime
3.8
Packaging format used
PyPi
Debugging logs
The text was updated successfully, but these errors were encountered:
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link
Expected Behaviour
According to the docs, we should be able to set the log level explicitly through the
level
parameter toLogger
.Current Behaviour
The
level
parameter is properly set the first time you instantiateLogger
, but subsequent instantiations with the same service name will not set the log level. (It will always be the original value from the first instance.)Code snippet
Possible Solution
In
Logger._init_logger
,setLevel
should be called before the early return.Steps to Reproduce
Run the following code:
Powertools for AWS Lambda (Python) version
latest
AWS Lambda function runtime
3.8
Packaging format used
PyPi
Debugging logs
The text was updated successfully, but these errors were encountered: