1
0
mirror of https://github.com/laurivosandi/certidude synced 2024-12-22 08:15:18 +00:00

Use UTC for log entries

This commit is contained in:
Lauri Võsandi 2016-04-05 15:30:50 +03:00
parent c33da46f19
commit 15858083b3
2 changed files with 3 additions and 2 deletions

View File

@ -1,6 +1,7 @@
import logging
import time
from datetime import datetime
from certidude.api.tag import RelationalMixin
class LogHandler(logging.Handler, RelationalMixin):
@ -12,7 +13,7 @@ class LogHandler(logging.Handler, RelationalMixin):
def emit(self, record):
self.sql_execute("log_insert_entry.sql",
time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(record.created)),
datetime.utcfromtimestamp(record.created),
record.name,
record.levelno,
record.levelname.lower(),

View File

@ -36,7 +36,7 @@ class PushLogHandler(logging.Handler):
def emit(self, record):
from certidude.push import publish
publish("log-entry", dict(
created = datetime.fromtimestamp(record.created),
created = datetime.utcfromtimestamp(record.created),
message = record.msg % record.args,
severity = record.levelname.lower()))