1
0
mirror of https://github.com/altlinux/gpupdate.git synced 2025-03-21 18:50:38 +03:00

Switch to new log message format

This commit is contained in:
Игорь Чудов 2020-07-23 18:24:27 +04:00
parent d608864f8a
commit bbb46f941f
Signed by untrusted user: nir
GPG Key ID: 0F3883600CAE7AAC

View File

@ -36,19 +36,19 @@ class slogm(object):
'''
Structured log message class
'''
def __init__(self, message, **kwargs):
def __init__(self, message, kwargs=dict()):
self.message = message
self.kwargs = kwargs
def __str__(self):
now = str(datetime.datetime.now())
args = dict()
args.update(dict({'timestamp': now, 'message': str(self.message)}))
#args.update(dict({'timestamp': now, 'message': str(self.message)}))
args.update(self.kwargs)
kwa = encoder().encode(args)
result = '{}:{}'.format(now.rpartition('.')[0], self.message)
result = '{}:{}:{}'.format(now.rpartition('.')[0], self.message, kwa)
return result