We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 747f92f commit 30d03e0Copy full SHA for 30d03e0
bluemath_tk/core/logging.py
@@ -37,12 +37,12 @@ def get_file_logger(
37
>>> # 2023-10-22 14:55:23,456 - my_app_logger - INFO - This is an info message.
38
>>> # 2023-10-22 14:55:23,457 - my_app_logger - WARNING - This is a warning message.
39
>>> # 2023-10-22 14:55:23,458 - my_app_logger - ERROR - This is an error message.
40
-
41
- Notes
42
- -----
43
- - TODO: Check a way to remove existing loggers to avoid duplicate logs.
44
"""
45
+ # If a logger with the specified name already exists, return it
+ if name in logging.Logger.manager.loggerDict:
+ return logging.getLogger(name)
+
46
# Create a logger with the specified name
47
logger = logging.getLogger(name)
48
logger.setLevel(level)
0 commit comments