From f707efdb6386381d4b7a51ce66f2f68dd8e2d8a6 Mon Sep 17 00:00:00 2001 From: Martin Palma Date: Tue, 24 Nov 2015 17:24:02 +0100 Subject: [PATCH] [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 --- ceph_deploy/util/log.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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) -- 2.47.3