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

Formatter config can be a map #123

Closed dvic closed 3 months ago

dvic commented 3 months ago

The documentation mentions that you can configure the logger like this:

:logger.update_handler_config(:default, :formatter, {Basic, []})

However, this will give a dialyzer error, because :logger.update_handler_config requires the options to be a map: https://www.erlang.org/doc/apps/kernel/logger.html#update_handler_config/3 and https://www.erlang.org/doc/apps/kernel/logger.html#t:formatter_config/0.

This PR changes the format/2 callback to supports opts that are maps and updates the docs so that users don't get dialyzer errors.

coveralls commented 3 months ago

Coverage Status

coverage: 100.0%. remained the same when pulling 374e0b9abb406a2e540ffd4c17973ed6c8dd5454 on qdentity:fix-logger-opts-maps into a43bcd39021c4df16c657f446b71e1e9d62fbb17 on Nebo15:master.