giantsd/utils/logger.py

17 lines
515 B
Python
Raw Normal View History

2019-01-22 01:30:42 +01:00
import logging
def setup_logger(name):
#_fh = logging.FileHandler("cerqual-deploy.log")
#_fh.setLevel("INFO")
_ch = logging.StreamHandler()
_ch.setLevel("DEBUG")
2019-03-13 01:37:49 +01:00
_formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
2019-01-22 01:30:42 +01:00
_ch.setFormatter(_formatter)
#_fh.setFormatter(_formatter)
logger = logging.getLogger(name)
logger.addHandler(_ch)
#logger.addHandler(_fh)
logger.setLevel("DEBUG")
logger.debug("Logger initialized")
return logger