Add centralised logging utility
This commit is contained in:
parent
452ee4ed3e
commit
8b0cec826a
1 changed files with 12 additions and 0 deletions
12
src/utils/logging.py
Normal file
12
src/utils/logging.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import logging
|
||||
import sys
|
||||
|
||||
|
||||
def get_logger(name: str) -> logging.Logger:
|
||||
logger = logging.getLogger(name)
|
||||
if not logger.handlers:
|
||||
handler = logging.StreamHandler(sys.stdout)
|
||||
handler.setFormatter(logging.Formatter("%(asctime)s [%(name)s] %(levelname)s %(message)s"))
|
||||
logger.addHandler(handler)
|
||||
logger.setLevel(logging.INFO)
|
||||
return logger
|
||||
Loading…
Reference in a new issue