rs / zerolog

Zero Allocation JSON Logger
MIT License
10.62k stars 572 forks source link

Add support for logger-local error handlers #528

Open elindsey opened 1 year ago

elindsey commented 1 year ago

There are some use cases for writing to zerolog from within the ErrorHandler, but today this is extremely tricky to do safely as it can easily lead to ErrorHandlers triggering ErrorHandlers (causing a log bomb). Logger-local error handlers allow us to configure eg. a primary logger with an ErrorHandler that calls a secondary logger with no ErrorHandler.

Event struct was rearranged to save space; gofmt adjusted some doc indenting in log.go.