From 0735f7360aed65258b59e8576bc93d2ac1d2b27b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Jan=20Niemier?= Date: Mon, 9 Sep 2019 23:12:08 +0200 Subject: [PATCH] Fix registration of Logger.ErlangHandler (spec mismatch) (#9330) 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. --- lib/logger/lib/logger/app.ex | 2 +- lib/logger/lib/logger/erlang_handler.ex | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/logger/lib/logger/app.ex b/lib/logger/lib/logger/app.ex index 5de6ef218d..9bc5d4b3a3 100644 --- a/lib/logger/lib/logger/app.ex +++ b/lib/logger/lib/logger/app.ex @@ -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 diff --git a/lib/logger/lib/logger/erlang_handler.ex b/lib/logger/lib/logger/erlang_handler.ex index d53d80b229..864e96c2dd 100644 --- a/lib/logger/lib/logger/erlang_handler.ex +++ b/lib/logger/lib/logger/erlang_handler.ex @@ -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