Switching to self-contained binary -
initial commit.
This commit is contained in:
20
logger.py
Normal file
20
logger.py
Normal file
@@ -0,0 +1,20 @@
|
||||
import logging, sys
|
||||
from config import Config
|
||||
|
||||
# Logging config section
|
||||
|
||||
LOG_TO = sys.stdout
|
||||
LOG_LEVEL = logging.INFO
|
||||
|
||||
logger = logging.getLogger(Config.APP_NAME)
|
||||
logger.setLevel(LOG_LEVEL)
|
||||
stdout_handler = logging.StreamHandler(LOG_TO)
|
||||
stdout_handler.setLevel(LOG_LEVEL)
|
||||
formatter = logging.Formatter(
|
||||
'[%(asctime)s] %(name)s: %(levelname)s: %(message)s',
|
||||
datefmt='%Y-%m-%d %H:%M:%S'
|
||||
)
|
||||
stdout_handler.setFormatter(formatter)
|
||||
if not logger.hasHandlers():
|
||||
logger.addHandler(stdout_handler)
|
||||
logger.propagate = False
|
||||
Reference in New Issue
Block a user