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:
parent
d608864f8a
commit
bbb46f941f
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user