Consider contextual, structured logging #828
KevinMGranger
started this conversation in
Ideas
Replies: 3 comments
-
Can you print a terminal output of the idea? Can it happen to have parallel logging? (two |
Beta Was this translation helpful? Give feedback.
0 replies
-
I can make a small proof of concept, yes. Right now we don't do any processing in parallel. Even if we did, we could use |
Beta Was this translation helpful? Give feedback.
0 replies
-
I've been playing with structlog and it's really, really cool. It might just be a good choice for this. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Right now, there's a lot of manual adding of contextual information to log statements. We'll commonly see the current
namespace
passed around just for logging purposes. We also repeat a lot of information while only inspecting one resource at a time.We could have a context that we fill and then remove information from, that's put before all log messages. Context vars would be kept in a dict and would be added to any log line (by changing the format we use).\
For example, taking a snippet from the committime base:
Unfortunately, we do see additional levels of nesting with each update. Some ideas for that:
try
/catch
and unset the context vars in thefinally
.I will admit, there's some level of "magic" happening here, which can be confusing. But we're seeing lots of debugging issues that would be solved with richer logs, and manual solutions are error-prone.
Beta Was this translation helpful? Give feedback.
All reactions