Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 10 additions & 0 deletions lib/sentry/logger_handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,16 @@ defmodule Sentry.LoggerHandler do
end
end

# Elixir 1.19 puts string translation inside the report instead of replacing
# it completely. We switch it back for compatibility with existing code.
defp log_unfiltered(
%{msg: {:report, %{elixir_translation: unicode_chardata}}} = log_event,
sentry_opts,
%__MODULE__{} = config
) do
log_unfiltered(%{log_event | msg: {:string, unicode_chardata}}, sentry_opts, config)
end

# A string was logged. We check for the :crash_reason metadata and try to build a sensible
# report from there, otherwise we use the logged string directly.
defp log_unfiltered(
Expand Down
4 changes: 2 additions & 2 deletions test/sentry/logger_handler_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ defmodule Sentry.LoggerHandlerTest do
assert %KeyError{} = event.original_exception
assert [exception] = event.exception
assert exception.type == "KeyError"
assert exception.value == "key :foo not found in: []"
assert exception.value =~ ~r"key :foo not found in:\s+\[\]"
assert Enum.find(exception.stacktrace.frames, &(&1.function =~ "Keyword.fetch!/2"))
end
end
Expand Down Expand Up @@ -286,7 +286,7 @@ defmodule Sentry.LoggerHandlerTest do
assert %KeyError{} = event.original_exception
assert [exception] = event.exception
assert exception.type == "KeyError"
assert exception.value == "key :foo not found in: []"
assert exception.value =~ ~r"key :foo not found in:\s+\[\]"
assert Enum.find(exception.stacktrace.frames, &(&1.function =~ "Keyword.fetch!/2"))
end

Expand Down