-
-
Notifications
You must be signed in to change notification settings - Fork 348
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
Add a custom stdlib logging.Formatter for MultiErrors #344
Add a custom stdlib logging.Formatter for MultiErrors #344
Conversation
This formatter will use `format_exception` to format all exceptions so that `MultiError` instances are logged properly. Documentation is included showing how to register the formatter. See python-triogh-305.
This is a great idea, thanks for looking at this. I'm hesitant about two things:
...so putting those together, I guess what I'm saying is... what do you think about monkeypatching I'm cringing just writing that, but we've kind of lost our innocence here already – we customize |
Codecov Report
@@ Coverage Diff @@
## master #344 +/- ##
==========================================
- Coverage 99.24% 99.23% -0.02%
==========================================
Files 87 87
Lines 10385 10806 +421
Branches 729 762 +33
==========================================
+ Hits 10307 10723 +416
- Misses 61 64 +3
- Partials 17 19 +2
Continue to review full report at Codecov.
|
(I think codecov is super-confused here because I merged #345 and then re-ran the travis tests, so there's some line mismatches between the Travis run and the Appveyor run. It should sort itself out if you push any more changes.) |
I think monkey patching on import makes it hard to opt out of the behavior. I don't think the behavior is bad or dangerous, but I can see it being irritating trying to avoid (we could rename the original so someone could put it back). Ideally users would be able to do something similar to how django sets up its loggers, where they have specific handlers for everything under the If we're looking to make it easy for people who just want it to work, offering a If you're already using something like https://github.com/madzak/python-json-logger, then monkey patching really is your best option at that point. |
Obsoleted by #347 |
This formatter will use
format_exception
to format all exceptions so thatMultiError
instances are logged properly.Documentation is included showing how to register the formatter.
See gh-305.