You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When error types implement the ObjectMarshaler interface and is logged as a zap.Error field, it is not respected by zapcore because we currently only respect the string returned by the error and fmt.Formatter interfaces.
We should prefer the ObjectMarshaler interface over either of these, since it provides a more flexible approach to log the error type.
Note that when the error object is logged via zap.Any or zap.Object, its ObjectMarshaler implementation will be respected.
The text was updated successfully, but these errors were encountered:
Previously, implementing `ObjectMarshaler` on an error type was ignored
unless the error was logged with `zap.Any` or `zap.Object`. We should
respect the `ObjectMarshaler` instead as this is more flexible than the
basic `error` or `fmt.Formatter` interfaces.
Resolvesuber-go#1365
When error types implement the ObjectMarshaler interface and is logged as a
zap.Error
field, it is not respected by zapcore because we currently only respect the string returned by the error andfmt.Formatter
interfaces.We should prefer the
ObjectMarshaler
interface over either of these, since it provides a more flexible approach to log the error type.Note that when the error object is logged via
zap.Any
orzap.Object
, itsObjectMarshaler
implementation will be respected.The text was updated successfully, but these errors were encountered: