Skip to content

Commit

Permalink
Fix registration of Logger.ErlangHandler (spec mismatch) (#9330)
Browse files Browse the repository at this point in the history
Dialyzer was issuing a warning on `logger:add_handler/3` call as
the key `sasl_reports?` should not be in the root of the map but 
rather within the `:config` key of the map.
  • Loading branch information
hauleth authored and fertapric committed Sep 9, 2019
1 parent 212ead5 commit 0735f73
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/logger/lib/logger/app.ex
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ defmodule Logger.App do
end

defp add_elixir_handler(sasl_reports?) do
config = %{level: :debug, sasl_reports?: sasl_reports?}
config = %{level: :debug, config: %{sasl_reports?: sasl_reports?}}
:logger.add_handler(Logger, Logger.ErlangHandler, config)
end

Expand Down
5 changes: 3 additions & 2 deletions lib/logger/lib/logger/erlang_handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ defmodule Logger.ErlangHandler do
@doc """
Hook required by `:logger`.
"""
def log(%{meta: %{domain: [:otp, :sasl | _]}}, %{sasl_reports?: false}) do
@spec log(:logger.log_event(), :logger.handler_config()) :: any()
def log(%{meta: %{domain: [:otp, :sasl | _]}}, %{config: %{sasl_reports?: false}}) do
:ok
end

def log(%{meta: %{domain: [:supervisor_report]}}, %{sasl_reports?: false}) do
def log(%{meta: %{domain: [:supervisor_report]}}, %{config: %{sasl_reports?: false}}) do
:ok
end

Expand Down

0 comments on commit 0735f73

Please sign in to comment.