feat: introduce log content on log records#170
feat: introduce log content on log records#170AWS-Samuel merged 1 commit intoOpenJobDescription:mainlinefrom
Conversation
e1370ee to
21a2083
Compare
ddneilson
left a comment
There was a problem hiding this comment.
This is great, Sam. Thanks for taking this on.
Can you also add some public documentation for this so that users of the library can discover that this extra log metadata exists? Perhaps as a docstring on the LOG global in this file?
For example, we communicate that there's a session_id metadata in the log messages here.
|
Chatted offline. We'll also need to make sure that the uses of this don't clobber the |
8b6b758 to
6b608c4
Compare
6b608c4 to
0acf917
Compare
Added, confirmed that the documentation shows up under hover text for
Confirmed that this was causing issue, so I added an override and added a test for this. |
ddneilson
left a comment
There was a problem hiding this comment.
One small nitpick. Thanks for fixing this up, Sam.
0acf917 to
2b68cb8
Compare
Signed-off-by: Samuel Anderson <119458760+AWS-Samuel@users.noreply.github.com>
2b68cb8 to
ac02a8e
Compare
|



What was the problem/requirement? (What/Why)
Consumers of the
openjd_sessionsmodule may want a means of filtering logs based on their contents.What was the solution? (How)
In order to solve this problem, this commit introduces a structure we can add to the
extrakwarg when logging messages. The value provided to theextrakwarg must be of typedict[str, Any], with the limitation that the keys cannot be an existing attribute name in LogRecord.This commit then introduces a
LogExtraInfoclass which is a Dictionary containing one key:openjd_log_content.openjd_log_contentis aFlagwhich allows combining multipleLogContentvalues through bitwise operators in order to indicate which contents are in the logged message.What is the impact of this change?
A
LogContentflag becomes available to attached to logged messages, that consumers of this package can use to filter log messages based on the type of log message.How was this change tested?
Yes, also added unit tests to confirm all expected fields in log records still exist
Was this change documented?
It is through the changelog.
Is this a breaking change?
No
Does this change impact security?
No
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.