PaperGPT / src /config.py
YDTsai's picture
first commit
fe0ce42
raw
history blame contribute delete
550 Bytes
import logging
def configure_logging(logging_level: str = "INFO"):
logging_level = logging_level.upper()
numeric_level = getattr(logging, logging_level, None)
if not isinstance(numeric_level, int):
raise Exception(f"Invalid log level: {numeric_level}")
logging.basicConfig(
level=numeric_level,
datefmt="%Y-%m-%d %H:%M:%S",
format=
"[%(asctime)s] [%(process)s] [%(levelname)s] [%(module)s]: #%(funcName)s @%(lineno)d: %(message)s",
)
logging.info(f"Logging level: {logging_level}")