Skip to content

Commit

Permalink
fix ignore list
Browse files Browse the repository at this point in the history
  • Loading branch information
whossname committed Jun 18, 2022
1 parent 734a836 commit bbd47fd
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/slack_logger_backend/logger.ex
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ defmodule SlackLoggerBackend.Logger do
levels -> levels
end

opts = [ignore_list: get_env(:ignore)]
opts = [ignore: get_env(:ignore)]
{:ok, %{levels: levels, opts: opts}}
end

Expand Down
26 changes: 26 additions & 0 deletions test/slack_logger_backend_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,30 @@ defmodule SlackLoggerBackendTest do

Application.delete_env(:slack_logger_backend, :debounce_seconds)
end

test "ignores errors in the ignore list", %{bypass: bypass} do
msg1 = "I don't want to see this"
msg2 = "I also don't want to see this"
msg3 = "But I do want to see this"

Application.put_env(:slack_logger_backend, :ignore, [msg1, msg2])
start()

Bypass.expect_once(bypass, fn conn ->
assert "/hook" == conn.request_path
assert "POST" == conn.method
Plug.Conn.resp(conn, 200, "ok")
end)

Logger.error(msg1)
Logger.error(msg2)
Logger.error("""
I don't want
to see this
""")
Logger.error(msg3)

Logger.flush()
:timer.sleep(100)
end
end

0 comments on commit bbd47fd

Please sign in to comment.