Pepe_1 / logger.py
nileshhanotia's picture
Rename utils.py to logger.py
c3c391a verified
raw
history blame
435 Bytes
import logging
from config.settings import LOG_LEVEL
def setup_logger(name):
logger = logging.getLogger(name)
logger.setLevel(LOG_LEVEL)
if not logger.handlers:
handler = logging.StreamHandler()
formatter = logging.Formatter(
'%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
handler.setFormatter(formatter)
logger.addHandler(handler)
return logger