mirror of
https://github.com/certbot/certbot.git
synced 2026-01-26 07:41:33 +03:00
logging: log timestamps as local timezone instead of UTC (#5607)
* logging: log timestamps as local timezone instead of UTC * test(logging): expect localtime instead of gmtime * linter fix in logging
This commit is contained in:
@@ -19,7 +19,6 @@ import logging.handlers
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
import traceback
|
||||
|
||||
from acme import messages
|
||||
@@ -148,7 +147,6 @@ def setup_log_file_handler(config, logfile, fmt):
|
||||
handler.doRollover() # TODO: creates empty letsencrypt.log.1 file
|
||||
handler.setLevel(logging.DEBUG)
|
||||
handler_formatter = logging.Formatter(fmt=fmt)
|
||||
handler_formatter.converter = time.gmtime # don't use localtime
|
||||
handler.setFormatter(handler_formatter)
|
||||
return handler, log_file_path
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ class SetupLogFileHandlerTest(test_util.ConfigTestCase):
|
||||
handler.close()
|
||||
|
||||
self.assertEqual(handler.level, logging.DEBUG)
|
||||
self.assertEqual(handler.formatter.converter, time.gmtime)
|
||||
self.assertEqual(handler.formatter.converter, time.localtime)
|
||||
|
||||
expected_path = os.path.join(self.config.logs_dir, log_file)
|
||||
self.assertEqual(log_path, expected_path)
|
||||
|
||||
Reference in New Issue
Block a user