From: Martin Palma Date: Tue, 24 Nov 2015 16:24:02 +0000 (+0100) Subject: [RM-13585] Own logging format for the log file output with timestamp when the X-Git-Tag: v1.5.29~3^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f707efdb6386381d4b7a51ce66f2f68dd8e2d8a6;p=ceph-deploy.git [RM-13585] Own logging format for the log file output with timestamp when the LogRecord was created. Removed obsolete timestamp replacement. Signed-off-by: Martin Palma --- diff --git a/ceph_deploy/util/log.py b/ceph_deploy/util/log.py index 1d27984..c72303c 100644 --- a/ceph_deploy/util/log.py +++ b/ceph_deploy/util/log.py @@ -1,6 +1,5 @@ import logging import sys -import datetime BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8) @@ -18,8 +17,8 @@ COLOR_SEQ = "\033[1;%dm" BOLD_SEQ = "\033[1m" BASE_COLOR_FORMAT = "[$BOLD%(name)s$RESET][%(color_levelname)-17s] %(message)s" -BASE_FORMAT = "[%(timestamp)s][%(name)s][%(levelname)-6s] %(message)s" - +BASE_FORMAT = "[%(name)s][%(levelname)-6s] %(message)s" +FILE_FORMAT = "[%(asctime)s]" + BASE_FORMAT def supports_color(): """ @@ -54,7 +53,6 @@ class ColoredFormatter(logging.Formatter): truncated_level = record.levelname[:6] levelname_color = COLOR_SEQ % (30 + COLORS[levelname]) + truncated_level + RESET_SEQ record.color_levelname = levelname_color - record.timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f') return logging.Formatter.format(self, record)