New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DM-30977: Add python log handler to store LogRecord as they come in #546
Conversation
DM-30996 will most likely add |
The new |
91873c3
to
365f2ce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, few minor comments.
These records can then be serialized in butler datastore.
There is a question as to whether this should be attached to the main message, kept as a separate string, or stored separately as a list of strings. For now it is stored as a separate single string.
This can be used to directly stream LogRecords in JSON format.
Returning a new ButlerLogRecords instance.
One record per line rather than a single JSON model per file.
This makes it available to test code and to other users without having to limit reading to butler formatter.
Also unify the format detection code rather than repeating it in stream and byte handling.
d198762
to
772330e
Compare
When splitting a potentially enormous string we want to avoid creating a list with potentially millions of elements.
f45f25f
to
877e3f9
Compare
This allows other test code to use it and encapsulates the access to the _MDC private dict.
Only make ButlerLogRecords public by default since that is the type stored in datastore. Also rename JsonFormatter to JsonLogFormatter to avoid confusion with the datastore formatter of the same name.
This temporarily changes the MDC for logging.
These records can then be serialized in butler datastore. This is assuming that lsst/log#55 is merged which will also need changes in daf_butler for initializing logging such that we no longer forward everything to lsst.log. Will need changes to ctrl_mpexec as well.
Checklist
doc/changes