Skip to content

Commit 095a86f

Browse files
docs(logging): docstrings and typehints
1 parent 310e25c commit 095a86f

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

glueops/setup_logging.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import inspect
22
import json
33
import logging
4+
from typing import Union
45

56

67
class JsonFormatter(logging.Formatter):
@@ -18,7 +19,22 @@ def format(self, record):
1819
return json.dumps(log_entry)
1920

2021

21-
def configure(name=None, level=logging.INFO, *handlers):
22+
def configure(
23+
name=None,
24+
level: Union[str, int]=logging.ERROR,
25+
*handlers: logging.Handler
26+
) -> logging.Logger:
27+
"""Configure and return a logger with GlueOps default configuration
28+
29+
Args:
30+
name (_type_, optional): The name of the logger. Defaults to None.
31+
level (Union[str, int], optional): The log level, as an int or str. Defaults to logging.ERROR.
32+
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.
34+
35+
Returns:
36+
logging.Logger: Instance of configured logger
37+
"""
2238
if name is None:
2339
frame = inspect.stack()[1]
2440
module = inspect.getmodule(frame[0])

0 commit comments

Comments
 (0)