summaryrefslogtreecommitdiff
path: root/src/logger.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2014-03-31 22:56:29 +0200
committermathieui <mathieui@mathieui.net>2014-04-01 00:03:29 +0200
commit02d9fd9ad4816f357c614a230b34d7e3fcdcdcf9 (patch)
treee01b0d03cf9527a8615cf8a9ecc3194366178419 /src/logger.py
parenta0c7155140f50b2b1c22e7c1347be1024d4e3af8 (diff)
downloadpoezio-02d9fd9ad4816f357c614a230b34d7e3fcdcdcf9.tar.gz
poezio-02d9fd9ad4816f357c614a230b34d7e3fcdcdcf9.tar.bz2
poezio-02d9fd9ad4816f357c614a230b34d7e3fcdcdcf9.tar.xz
poezio-02d9fd9ad4816f357c614a230b34d7e3fcdcdcf9.zip
Fix #2462 (wrong timezone in the logs)
Now everything in the logs is in UTC time, and is converted when read (also, actually return the logs after loading them instead of not doing anything)
Diffstat (limited to 'src/logger.py')
-rw-r--r--src/logger.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/logger.py b/src/logger.py
index c05cc4a6..2c878606 100644
--- a/src/logger.py
+++ b/src/logger.py
@@ -5,11 +5,13 @@
# Poezio is free software: you can redistribute it and/or modify
# it under the terms of the zlib license. See the COPYING file.
-from os import environ, makedirs
import mmap
import os
import re
+from os import environ, makedirs
from datetime import datetime
+
+import common
from config import config
from xhtml import clean_text
from theming import dump_tuple, get_theme
@@ -155,7 +157,9 @@ class Logger(object):
log.debug('format? %s', tup)
continue
time = [int(i) for index, i in enumerate(tup) if index < 6]
- message = {'lines': [], 'history': True, 'time': datetime(*time)}
+ message = {'lines': [],
+ 'history': True,
+ 'time': common.get_local_time(datetime(*time))}
size = int(tup[6])
if len(tup) == 8: #info line
message['lines'].append(color+tup[7])
@@ -195,9 +199,9 @@ class Logger(object):
try:
msg = clean_text(msg)
if date is None:
- str_time = datetime.now().strftime('%Y%m%dT%H:%M:%SZ')
+ str_time = common.get_utc_time().strftime('%Y%m%dT%H:%M:%SZ')
else:
- str_time = date.strftime('%Y%m%dT%H:%M:%SZ')
+ str_time = common.get_utc_time(date).strftime('%Y%m%dT%H:%M:%SZ')
if typ == 1:
prefix = 'MR'
else:
@@ -244,7 +248,7 @@ class Logger(object):
exc_info=True)
return False
try:
- str_time = datetime.now().strftime('%Y%m%dT%H:%M:%SZ')
+ str_time = common.get_utc_time().strftime('%Y%m%dT%H:%M:%SZ')
message = clean_text(message)
lines = message.split('\n')
first_line = lines.pop(0)