From d85f8c4f6198263de0be5fcd854bc427fece0669 Mon Sep 17 00:00:00 2001 From: interkosmos Date: Sat, 19 Nov 2016 12:16:16 +0100 Subject: [PATCH] Changed logging. --- openadms.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openadms.py b/openadms.py index 8ed2196..1edfa94 100755 --- a/openadms.py +++ b/openadms.py @@ -125,18 +125,20 @@ def stay_alive(): # '%(message)s' fmt = '%(asctime)s - %(levelname)7s - %(module)12s - %(message)s' formatter = logging.Formatter(fmt) - # Logging file handler. + + # File handler. fh = logging.handlers.RotatingFileHandler(LOG_FILE, maxBytes=10485760, # 10 MB. backupCount=1, encoding='utf8') fh.setLevel(level) fh.setFormatter(formatter) + # Add handlers to logger. logger.addHandler(fh) date_fmt = '%Y-%m-%dT%H:%M:%S' - coloredlogs.install(level=level, fmt=fmt, datefmt=date_fmt) + coloredlogs.install(level=logging.DEBUG, fmt=fmt, datefmt=date_fmt) # Use a signal handler to catch ^C and quit the program gracefully. signal.signal(signal.SIGINT, signal_handler)