Closed tgrk closed 4 years ago
Hello @tgrk,
I think it would be a generally bad idea to start implementing Jason.Encoder
protocol in libraries (LoggerJSON or any other) because it would break some of the apps that already implement it and rely on their implementation to be valid. Eg. they encode using specific format or their tests rely on Jason.Encoder.NotImplemented
exception for PID's.
A proper way to fix this would be to recursively iterate over metadata struct and use inspect on any value that does not have a Jason.Encoder
protocol implemented for it.
@AndrewDryga Very good point. 🤦 It sounds to me to have this part of a custom formatter (as there will be some performance overhead of this recursion check for metadata) and not everyone is probably having similar issues. Thank you!
While using default Google Stackdriver formater I was experiencing issues with
UndefinedProtocol
forPID
when usingjason
encoder. This happened in crashes (:ancestors
field) and resulted in errors. UsingJason.Encoder
forPID
fixes the problem.Thanks for your
logger_json
as structured logging significantly improved our ability to find and identify issues.