File tree Expand file tree Collapse file tree 4 files changed +7
-6
lines changed Expand file tree Collapse file tree 4 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -204,8 +204,8 @@ defmodule LoggerJSON do
204204 |> Keyword . get ( :metadata , [ ] )
205205 |> configure_metadata ( )
206206
207- formatter_opts = Keyword . get ( config , :formatter_opts , % { } )
208- formatter_state = apply ( formatter , : init, [ formatter_opts ] )
207+ formatter_opts = Keyword . get ( config , :formatter_opts , [ ] )
208+ formatter_state = formatter . init ( formatter_opts )
209209
210210 % {
211211 state
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ defmodule LoggerJSON.Formatter do
1111
1212 Returned list will be used as formatter_state in `format_event/6`.
1313 """
14- @ callback init ( Keyword . t ( ) ) :: Keyword . t ( )
14+ @ callback init ( Keyword . t ( ) ) :: term ( )
1515
1616 @ doc """
1717 Format event callback.
Original file line number Diff line number Diff line change @@ -32,8 +32,9 @@ defmodule LoggerJSON.Formatters.DatadogLogger do
3232 @ processed_metadata_keys ~w[ pid file line function module application span_id trace_id otel_span_id otel_trace_id] a
3333
3434 @ impl true
35- def init ( formatter_opts \\ % { } ) do
36- opts = Map . merge ( @ default_opts , formatter_opts )
35+ def init ( formatter_opts ) do
36+ # Notice: we also accept formatter_opts for DataDog logger as a map for backwards compatibility
37+ opts = Map . merge ( @ default_opts , Map . new ( formatter_opts ) )
3738
3839 unless is_binary ( opts . hostname ) or opts . hostname in [ :system , :unset ] do
3940 raise ArgumentError ,
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ defmodule LoggerJSON.Mixfile do
22 use Mix.Project
33
44 @ source_url "https://github.com/Nebo15/logger_json"
5- @ version "5.1.1 "
5+ @ version "5.1.2 "
66
77 def project do
88 [
You can’t perform that action at this time.
0 commit comments