mirror of
https://github.com/RichieCahill/dotfiles.git
synced 2026-04-17 13:08:19 -04:00
playing with logging
This commit is contained in:
16
python/testing/logging/configure_logger.py
Normal file
16
python/testing/logging/configure_logger.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import logging
|
||||
import sys
|
||||
|
||||
|
||||
def configure_logger(level: str = "INFO", test: str = None) -> None:
|
||||
"""Configure the logger.
|
||||
Args:
|
||||
level (str, optional): The logging level. Defaults to "INFO".
|
||||
"""
|
||||
logging.basicConfig(
|
||||
level=level,
|
||||
datefmt="%Y-%m-%dT%H:%M:%S%z",
|
||||
format="%(asctime)s %(levelname)s %(filename)s:%(lineno)d - %(message)s"
|
||||
f" {test}",
|
||||
handlers=[logging.StreamHandler(sys.stdout)],
|
||||
)
|
||||
Reference in New Issue
Block a user