mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-28 04:02:38 +00:00
maintain list of positional arguments as tuple
Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
This commit is contained in:
parent
5803d9999d
commit
57a0f76e1f
@ -297,7 +297,7 @@ class LogCallDeferredTests(TestCase):
|
|||||||
self.assertThat(
|
self.assertThat(
|
||||||
f(4), succeeded(Equals(16)))
|
f(4), succeeded(Equals(16)))
|
||||||
msg = logger.messages[0]
|
msg = logger.messages[0]
|
||||||
assertContainsFields(self, msg, {"args": {'arg_0': 4}})
|
assertContainsFields(self, msg, {"args": (4,)})
|
||||||
|
|
||||||
@capture_logging(
|
@capture_logging(
|
||||||
lambda self, logger:
|
lambda self, logger:
|
||||||
@ -328,5 +328,5 @@ class LogCallDeferredTests(TestCase):
|
|||||||
return base ** exp
|
return base ** exp
|
||||||
self.assertThat(f(10, 2, message="an exponential function"), succeeded(Equals(100)))
|
self.assertThat(f(10, 2, message="an exponential function"), succeeded(Equals(100)))
|
||||||
msg = logger.messages[0]
|
msg = logger.messages[0]
|
||||||
assertContainsFields(self, msg, {"args": {'arg_0': 10, 'arg_1': 2}})
|
assertContainsFields(self, msg, {"args": (10, 2)})
|
||||||
assertContainsFields(self, msg, {"kwargs": {"message": "an exponential function"}})
|
assertContainsFields(self, msg, {"kwargs": {"message": "an exponential function"}})
|
||||||
|
@ -335,11 +335,7 @@ def log_call_deferred(action_type):
|
|||||||
kwargs = {k: bytes_to_unicode(True, kw[k]) for k in kw}
|
kwargs = {k: bytes_to_unicode(True, kw[k]) for k in kw}
|
||||||
# Remove complex (unserializable) objects from positional args to
|
# Remove complex (unserializable) objects from positional args to
|
||||||
# prevent eliot from throwing errors when it attempts serialization
|
# prevent eliot from throwing errors when it attempts serialization
|
||||||
args = {
|
args = tuple([a[pos] for pos in range(len(a)) if is_json_serializable(a[pos])])
|
||||||
"arg_" + str(pos): bytes_to_unicode(True, a[pos])
|
|
||||||
for pos in range(len(a))
|
|
||||||
if is_json_serializable(a[pos])
|
|
||||||
}
|
|
||||||
with start_action(action_type=action_type, args=args, kwargs=kwargs).context():
|
with start_action(action_type=action_type, args=args, kwargs=kwargs).context():
|
||||||
# Use addActionFinish so that the action finishes when the
|
# Use addActionFinish so that the action finishes when the
|
||||||
# Deferred fires.
|
# Deferred fires.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user