Using _log
instead of higher level interfaces like debug
or info
.
#44
YooSunYoung
started this conversation in
Design Choices
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently,
beamlime.core.application._LogMixin
useslogger._log
instead of higher interfaces likedebug
orinfo
.It is because
*args
, it is easy to accidentally unpack them, which causesTypeError: not all arguments converted during string formatting
.Here is the rough idea of what I initially tried to implement as a log wrapper,
with
app_name
keyword in theextra
.Then it had unexpected output:
Here are the code benchmarks for reproducing this issue.
Context
This context will apply for all following test cases.
Key-word argument only
Passing key-word argument logs the same message twice, one with the extra-key-word
app_name
and one more without.It seems like the logging is called twice as it updates the record. (Didn't really investigate deeply enough).
Unexpected unpacked arguments
Proper usage
Wrong usage
It seems very obvious that it is wrong in this example, but when the *args type is general
and didn't expect any list-like object, it just happened, and took quite some time to figure out...!
Beta Was this translation helpful? Give feedback.
All reactions