From 7f322c3b85d9907821b9796f8f19a848b7d26fbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Niemier?= Date: Fri, 6 Sep 2019 18:11:39 +0200 Subject: [PATCH] fix: registration of ErlangHandler spec mismatch The Dialyzer was issuing a warining on `logger:add_handler/3` call as the key `sasl_reports?` should not be in root map but rather within `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