Skip to content

Commit 4e9f41f

Browse files
fix(setup_logging): remove argument unpacking is a positional argument and collides with named arguments (#2)
1 parent 20175ec commit 4e9f41f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

glueops/setup_logging.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import inspect
22
import json
33
import logging
4-
from typing import Union
4+
from typing import List, Union
55

66

77
class JsonFormatter(logging.Formatter):
@@ -20,17 +20,17 @@ def format(self, record):
2020

2121

2222
def configure(
23-
name=None,
23+
name: str=None,
2424
level: Union[str, int]=logging.ERROR,
25-
*handlers: logging.Handler
25+
handlers: List[logging.Handler]= None
2626
) -> logging.Logger:
2727
"""Configure and return a logger with GlueOps default configuration
2828
2929
Args:
30-
name (_type_, optional): The name of the logger. Defaults to None.
30+
name (str, optional): The name of the logger. Defaults to None.
3131
level (Union[str, int], optional): The log level, as an int or str. Defaults to logging.ERROR.
3232
Must be less restrictive than the level applied to additional handlers for those handlers to receive logs
33-
*handlers (logging.Handler, optional): Add any additional handlers that may be desired.
33+
handlers (List[logging.Handler], optional): List of any additional handlers that may be desired. Defaults to None.
3434
3535
Returns:
3636
logging.Logger: Instance of configured logger
@@ -40,6 +40,9 @@ def configure(
4040
module = inspect.getmodule(frame[0])
4141
name = module.__name__ if module else "defaultLogger"
4242

43+
if handlers is None:
44+
handlers = []
45+
4346
logger = logging.getLogger(name)
4447
logger.setLevel(level)
4548

0 commit comments

Comments
 (0)