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.
This commit is contained in:
Steve Cohen
2025-08-07 20:25:38 +02:00
committed by GitHub
parent 67042e8770
commit 1f786273e6
+3 -2
View File
@@ -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