Skip to content

Static typing: aws_lambda_powertools.logging.utils.copy_config_to_registered_loggers argument log_level should accept int #1525

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

Closed
kbakk opened this issue Sep 20, 2022 · 3 comments · Fixed by #1534
Labels
logger typing Static typing definition related issues (mypy, pyright, etc.)

Comments

@kbakk
Copy link
Contributor

kbakk commented Sep 20, 2022

Static type checker used

mypy (project's standard)

AWS Lambda function runtime

3.9

AWS Lambda Powertools for Python version

latest

Static type checker info

$ mypy repro.py
repro.py:5: error: Argument "log_level" to "copy_config_to_registered_loggers" has incompatible type "int"; expected "Optional[str]"
Found 1 error in 1 file (checked 1 source file)
mypy --version
mypy 0.971 (compiled: yes)

Code snippet

from aws_lambda_powertools.logging import utils
from aws_lambda_powertools import Logger

logger = Logger()
utils.copy_config_to_registered_loggers(source_logger=logger, log_level=30)

Possible Solution

Update signature to accept Union[str, int]

@kbakk kbakk added triage Pending triage from maintainers typing Static typing definition related issues (mypy, pyright, etc.) labels Sep 20, 2022
@heitorlessa
Copy link
Contributor

Agreed, wanna send a quick PR for this @kbakk?

And thank you for flagging that!

@heitorlessa heitorlessa added logger and removed triage Pending triage from maintainers labels Sep 21, 2022
@github-actions
Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

This issue is now closed. Please be mindful that future comments are hard for our team to see.

If you need more assistance, please either tag a team member or open a new issue that references this one.

If you wish to keep having a conversation with other community members under this issue feel free to do so.

@heitorlessa heitorlessa added the pending-release Fix or implementation already in dev waiting to be released label Sep 21, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2022

This is now released under 1.30.0 version!

@github-actions github-actions bot removed the pending-release Fix or implementation already in dev waiting to be released label Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logger typing Static typing definition related issues (mypy, pyright, etc.)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants