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
@mickeyreiss if you are using the JSONFormatter, a simple fix woul be to add empty json tag to your structure for this field.
The func would be then skipped by the standard library json encoder.
@dgsb That would work if every dev understood what is and is not allowed to be logged in logrus.Fields values (which are typed as an interface{}.) Unfortunately that limitation is not well understood (for example because it doesn't follow the same rules as fmt.Printf), and then panic recovery code inadvertently writes logs and panics again.
Another issue I've faced: Some third-party libraries (e.g. pubsub) may define such struct types without json tags.
@mickeyreiss we completely rely on the standard library for the json encoding. There is not so many things we can do here to fix this. I can think of two options here, either you add tag to skip such fields or you wrap the structure itself in another one which implements the MarshalJSON interface.
You can find more information here https://golang.org/pkg/encoding/json/#Marshal
In #870, logrus added support for gracefully avoiding logging
func
s. However, this solution did not coverfunc
values nested withinstruct
s.This has caused panics in our staging and production environments when inadvertently passing in complex structs as fields.
cc/ @smacker
cc/ @dgsb
The text was updated successfully, but these errors were encountered: