Skip to content
Snippets Groups Projects
Commit 56fa64ea authored by Sybren A. Stüvel's avatar Sybren A. Stüvel
Browse files

Worker: Add timestamp to log entries.

parent aa3af967
No related branches found
No related tags found
No related merge requests found
import datetime
class tzutc(datetime.tzinfo):
"""tzinfo subclass for UTC time."""
def utcoffset(self, dt):
return datetime.timedelta(0)
def dst(self, dt):
return datetime.timedelta(0)
def tzname(self, dt):
return "UTC"
def is_ambiguous(self, dt):
return False
def __eq__(self, other):
if not isinstance(other, tzutc):
return NotImplemented
return True
__hash__ = None
def __ne__(self, other):
return not (self == other)
def __repr__(self):
return "%s()" % self.__class__.__name__
......@@ -237,7 +237,10 @@ class FlamencoWorker:
def register_log(self, log_entry):
"""Registers a log entry, and possibly sends all queued log entries to upstream Master."""
self.queued_log_entries.append(log_entry)
from . import tz
now = datetime.datetime.now(tz.tzutc()).isoformat()
self.queued_log_entries.append('%s: %s' % (now, log_entry))
if len(self.queued_log_entries) > PUSH_LOG_MAX_ENTRIES:
self._log.info('Queued up more than %i log entries, pushing to master',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment