Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions lib/logger/lib/logger.ex
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,8 @@ 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}} ->
if ensure_binary(msg) =~ "password" do
:stop
else
:ignore
Expand All @@ -447,6 +447,14 @@ defmodule Logger do
:ignore
end
end

defp ensure_binary(charlist) when is_list(charlist) do
List.to_string(charlist)
end

defp ensure_binary(string) when is_binary(string) do
string
end
end

The filter may return the possibly modified event (to change the
Expand Down