Nebo15 / logger_json

JSON logger formatter with support for Google Cloud, DataDog and other for Elixir.
https://nebo15.github.io/logger_json/
MIT License
242 stars 94 forks source link

Behaviour and implemenation inconsistent #95

Closed kevin-papa closed 2 years ago

kevin-papa commented 2 years ago

As I was upgrading from 5.0 to 5.1 I noticed that the callback here is inconsistent with the DataDog implementation:

https://github.com/Nebo15/logger_json/blob/93ef51c84cdad8507a4e0a304f4ca2dc9d68a099/lib/logger_json/formatter.ex#L14

DataDog:

https://github.com/Nebo15/logger_json/blob/93ef51c84cdad8507a4e0a304f4ca2dc9d68a099/lib/logger_json/formatters/datadog_logger.ex#L35

AndrewDryga commented 2 years ago

Hello @kevin-papa, thank you for a good catch! A PR would be welcome to change the typespec, otherwise I'll just do it myself in a bit of time.

objectuser commented 2 years ago

@AndrewDryga BTW I do think this is a breaking change between 5.0 and 5.1. It used to be that a Keyword list worked from the init but no longer does. That's what pointed me to this.

AndrewDryga commented 2 years ago

@objectuser indeed there is an inconsistency with it but there are no breaking changes - formatter_opts are recently added and only this option was affected. I've pushed a change that will fix this inconsistency: https://github.com/Nebo15/logger_json/commit/e363887361cf5f265686113ce480722bba53cea7