-
Notifications
You must be signed in to change notification settings - Fork 111
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
Structlog processor formatter #1289
Conversation
🦙 MegaLinter status: ✅ SUCCESS
See detailed report in MegaLinter reports |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1289 +/- ##
=======================================
Coverage 81.29% 81.30%
=======================================
Files 201 201
Lines 22174 22185 +11
Branches 3519 3520 +1
=======================================
+ Hits 18027 18037 +10
- Misses 2981 2984 +3
+ Partials 1166 1164 -2 ☔ View full report in Codecov by Sentry. |
newrelic/hooks/logger_structlog.py
Outdated
elif isinstance(event, tuple) and event[0][0] and "event" in event[0][0]: | ||
event[0][0]["event"] = message |
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.
Let's throw this into a try/except block to prevent crashes, make this an else and then an if underneath.
This PR provides a fix for the case where structlog's ProcessorFormatter is used as a logging.Formatter for both logging as well as structlog log entries.
For more information about this functionality: https://www.structlog.org/en/stable/standard-library.html#rendering-using-structlog-based-formatters-within-logging