hebdobot/logger.py
2024-01-11 08:17:25 +01:00

30 lines
547 B
Python

import logging
import settings
def init_logger():
logging.basicConfig(
filename=settings.LOGFILE,
encoding="utf-8",
level=settings.LOGLEVEL,
format=settings.LOGFORMAT,
datefmt=settings.LOGDATE,
)
return logging.getLogger(__name__)
def info(message):
logger = init_logger()
logger.info(f"INFO - {message}")
def error(message):
logger = init_logger()
logger.error(f"ERROR - {message}")
def debug(message):
logger = init_logger()
logger.debug(f"DEBUG - {message}")