rs / zerolog

Zero Allocation JSON Logger
MIT License
10.39k stars 566 forks source link

MarshalZerologObject is not called on embedded structs #600

Open bertold opened 11 months ago

bertold commented 11 months ago

I would like to suppress logging certain fields in particular struct. This works fine with the Interface() call when the struct is used directly and the struct implements the LogObjectMarshaler interface. However, if the same type is included in another struct, then the LogObjectMarshaler is not called on the embedded object.

For illustration see this sample on the Go Playground.