From f036019a4f5ce8b43d0c1b704ae1a67e36b6b6ac Mon Sep 17 00:00:00 2001 From: kaliko Date: Fri, 20 Jun 2014 20:19:18 +0200 Subject: [PATCH] Removed timestamp for console logging --- doc/Changelog | 3 ++- sima/lib/logger.py | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index 54209d1..4c66815 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -2,7 +2,8 @@ MPD_sima v0.12.1 * Fixed SIGHUP error, need python-musicpd >= 0.4.1 * Add core plugin to detect multiple MPD_sima instance on the same MPD host - * fixed startup robustness + * Fixed startup robustness + * Removed timestamp in console logging -- kaliko jack UNRELEASED diff --git a/sima/lib/logger.py b/sima/lib/logger.py index 05f9c35..b27d4f0 100644 --- a/sima/lib/logger.py +++ b/sima/lib/logger.py @@ -28,8 +28,8 @@ import sys LOG_FORMATS = { - logging.DEBUG: '{asctime} {filename: >11}:{lineno: <3} {levelname: <7}: {message}', - logging.INFO: '{asctime} {levelname: <7}: {message}', + logging.DEBUG: '[{process}]{filename: >11}:{lineno: <3} {levelname: <7}: {message}', + logging.INFO: '{levelname: <7}: {message}', #logging.DEBUG: '{asctime} {filename}:{lineno}({funcName}) ' #'{levelname}: {message}', } @@ -78,6 +78,9 @@ def set_logger(level='info', logfile=None): if logfile: if filehdl: logg.handlers = [] + # Add timestamp for file handler + log_format = '{0} {1}'.format('{asctime}', log_format) + formatter = logging.Formatter(log_format, DATE_FMT, '{') # create file handler fileh = logging.FileHandler(logfile) #fileh.setLevel(user_log_level) -- 2.39.5