Send runlogdate as date

Change-Id: Ie02ee74289095aed7132b65bad634a01504067ab
This commit is contained in:
Kerim Gokarslan 2017-09-14 14:29:02 -07:00
parent a429e9c0fb
commit b1c6d9d210

View File

@ -34,14 +34,14 @@ class FluentLogHandler(logging.Handler):
self.tag = tag
self.formatter = logging.Formatter('%(message)s')
self.sender = sender.FluentSender(self.tag, host=fluentd_ip, port=fluentd_port)
self.runlogdate = 0
self.runlogdate = datetime.utcnow().replace(tzinfo=pytz.utc).strftime(
"%Y-%m-%dT%H:%M:%S.%f%z")
self.__warning_counter = 0
self.__error_counter = 0
def start_new_run(self):
'''Delimitate a new run in the stream of records with a new timestamp
'''
self.runlogdate = str(datetime.now())
# reset counters
self.__warning_counter = 0
self.__error_counter = 0