- Issue created by @mfb
- Merge request !7892Issue #3340970 by mfb: Pass criticality/fatality of log events to loggers β (Open) created by mfb
- Status changed to Needs review
16 days ago 10:01pm 2 May 2024 - πΊπΈUnited States cmlara
Why add it as an array pass through?β (more array mess)
βImplement a logger and try to figure out if a log event should be considered critical/fatal or not.β
I would be curious if you have a real life scenario that this information is actually useful for?To me it appears this is internal method data that is not needed or useful outside the method. Primarily looks like it is intended to control if an error gets raised to the server logs as well as the Drupal logs.
If it is important why not add it directly to the logged message rather than just hoping for a logger to act on it?
- πΊπΈUnited States mfb San Francisco
@cmlara the PSR-3 logging standard provides a context array to pass arbitrary context data to loggers. So that's what I'm proposing to use (it may be helpful to somehow namespace usage of the context array, however, as I mentioned in the issue summary)
In Raven module β we try to figure out if an error/exception was more-or-less "handled" somehow (i.e. caught, logged and ignored), or more-or-less "unhandled" and logged by one of the final error/exception logging mechanisms.
At the moment, core doesn't add anything to the context array about the disposition of the error or the mechanism logging it, so the best a logger can do is try to figure that out by looking at the backtrace. Which works fine, but is a bit hacky for my taste.
- πΊπΈUnited States mfb San Francisco
Updated the issue summary to explain why this internal method data may be useful to other loggers, not just Drupal core.