Skip to content

Commit 1f78627

Browse files
authored
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.
1 parent 67042e8 commit 1f78627

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/logger/lib/logger.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,9 @@ defmodule Logger do
436436
defmodule LogFilter do
437437
def filter(log_event, _opts) do
438438
case log_event do
439-
%{msg: msg} when is_binary(msg) ->
440-
if msg =~ "password" do
439+
%{msg: {:string, msg}} ->
440+
# msg may be a charlist or a binary
441+
if to_string(msg) =~ "password" do
441442
:stop
442443
else
443444
:ignore

0 commit comments

Comments
 (0)