mirror of
https://github.com/altlinux/gpupdate.git
synced 2025-03-21 18:50:38 +03:00
util.logging: Show milliseconds in logs and handle parameter errors
This commit is contained in:
parent
3d39e1f010
commit
674f07569e
@ -43,16 +43,18 @@ class slogm(object):
|
||||
def __init__(self, message, kwargs=dict()):
|
||||
self.message = message
|
||||
self.kwargs = kwargs
|
||||
if not self.kwargs:
|
||||
self.kwargs = dict()
|
||||
|
||||
def __str__(self):
|
||||
now = str(datetime.datetime.now())
|
||||
now = str(datetime.datetime.now().isoformat(sep=' ', timespec='milliseconds'))
|
||||
args = dict()
|
||||
#args.update(dict({'timestamp': now, 'message': str(self.message)}))
|
||||
args.update(self.kwargs)
|
||||
|
||||
kwa = encoder().encode(args)
|
||||
|
||||
result = '{}|{}|{}'.format(now.rpartition('.')[0], self.message, kwa)
|
||||
result = '{}|{}|{}'.format(now, self.message, kwa)
|
||||
|
||||
return result
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user