mirror of
https://github.com/laurivosandi/certidude
synced 2024-12-22 16:25:17 +00:00
Use UTC for log entries
This commit is contained in:
parent
c33da46f19
commit
15858083b3
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
|
from datetime import datetime
|
||||||
from certidude.api.tag import RelationalMixin
|
from certidude.api.tag import RelationalMixin
|
||||||
|
|
||||||
class LogHandler(logging.Handler, RelationalMixin):
|
class LogHandler(logging.Handler, RelationalMixin):
|
||||||
@ -12,7 +13,7 @@ class LogHandler(logging.Handler, RelationalMixin):
|
|||||||
|
|
||||||
def emit(self, record):
|
def emit(self, record):
|
||||||
self.sql_execute("log_insert_entry.sql",
|
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.name,
|
||||||
record.levelno,
|
record.levelno,
|
||||||
record.levelname.lower(),
|
record.levelname.lower(),
|
||||||
|
@ -36,7 +36,7 @@ class PushLogHandler(logging.Handler):
|
|||||||
def emit(self, record):
|
def emit(self, record):
|
||||||
from certidude.push import publish
|
from certidude.push import publish
|
||||||
publish("log-entry", dict(
|
publish("log-entry", dict(
|
||||||
created = datetime.fromtimestamp(record.created),
|
created = datetime.utcfromtimestamp(record.created),
|
||||||
message = record.msg % record.args,
|
message = record.msg % record.args,
|
||||||
severity = record.levelname.lower()))
|
severity = record.levelname.lower()))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user