Repository: aws-powertools/powertools-lambda-python

Issue:
Static typing: aws_lambda_powertools.logging.utils.copy_config_to_registered_loggers argument log_level should accept int
### 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

```python
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]`


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

And thank you for flagging that!

Resolving patch:
diff --git a/aws_lambda_powertools/logging/utils.py b/aws_lambda_powertools/logging/utils.py
--- a/aws_lambda_powertools/logging/utils.py
+++ b/aws_lambda_powertools/logging/utils.py
@@ -8,7 +8,7 @@
 
 def copy_config_to_registered_loggers(
     source_logger: Logger,
-    log_level: Optional[str] = None,
+    log_level: Optional[Union[int, str]] = None,
     exclude: Optional[Set[str]] = None,
     include: Optional[Set[str]] = None,
 ) -> None:
@@ -19,7 +19,7 @@ def copy_config_to_registered_loggers(
     ----------
     source_logger : Logger
         Powertools Logger to copy configuration from
-    log_level : str, optional
+    log_level : Union[int, str], optional
         Logging level to set to registered loggers, by default uses source_logger logging level
     include : Optional[Set[str]], optional
         List of logger names to include, by default all registered loggers are included


Test patch:
diff --git a/tests/functional/test_logger_utils.py b/tests/functional/test_logger_utils.py
--- a/tests/functional/test_logger_utils.py
+++ b/tests/functional/test_logger_utils.py
@@ -161,15 +161,17 @@ def test_copy_config_to_ext_loggers_clean_old_handlers(stdout, logger, log_level
     assert isinstance(logger.handlers[0].formatter, formatter.LambdaPowertoolsFormatter)
 
 
-def test_copy_config_to_ext_loggers_custom_log_level(stdout, logger, log_level):
+@pytest.mark.parametrize("level_to_set", ["WARNING", 30])
+def test_copy_config_to_ext_loggers_custom_log_level(stdout, logger, log_level, level_to_set):
     # GIVEN an external logger and powertools logger initialized
     logger = logger()
     powertools_logger = Logger(service=service_name(), level=log_level.CRITICAL.value, stream=stdout)
-    level = log_level.WARNING.name
 
     # WHEN configuration copied from powertools logger to INCLUDED external logger
     # AND external logger used with custom log_level
-    utils.copy_config_to_registered_loggers(source_logger=powertools_logger, include={logger.name}, log_level=level)
+    utils.copy_config_to_registered_loggers(
+        source_logger=powertools_logger, include={logger.name}, log_level=level_to_set
+    )
     msg = "test message4"
     logger.warning(msg)
     log = capture_logging_output(stdout)