From 1f786273e62c95b94466b3afdfbb81b366ffca64 Mon Sep 17 00:00:00 2001 From: Steve Cohen <55809+scohen@users.noreply.github.com> Date: Thu, 7 Aug 2025 11:25:38 -0700 Subject: [PATCH] Fix filtering documentation (#14705) The filtering documentation implied that the msg attribute of the logger event map could be a binary, but according to the erlang types (https://www.erlang.org/doc/apps/kernel/logger.html#t:log_event/0) it can't be a binary. This change updates the docs with an example that comports with the actual typing. --- lib/logger/lib/logger.ex | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/logger/lib/logger.ex b/lib/logger/lib/logger.ex index f3f98e2922..17c20f9a79 100644 --- a/lib/logger/lib/logger.ex +++ b/lib/logger/lib/logger.ex @@ -436,8 +436,9 @@ defmodule Logger do defmodule LogFilter do def filter(log_event, _opts) do case log_event do - %{msg: msg} when is_binary(msg) -> - if msg =~ "password" do + %{msg: {:string, msg}} -> + # msg may be a charlist or a binary + if to_string(msg) =~ "password" do :stop else :ignore