Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix log formatting under 1.14 #851

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
44 changes: 44 additions & 0 deletions lib/sentry/logger_handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,50 @@
%{format: ~c"Ranch listener ~p" ++ _, args: args} ->
capture_from_ranch_error(args, sentry_opts, config)

# %{
# label: {:proc_lib, :crash},
# report: [
# [
# initial_call: {Phoenix.LiveReloader.Channel, :join, [:Argument__1, :Argument__2, :Argument__3]},
# pid: "pid id",
# registered_name: [],
# error_info: {
# :error,
# %ArgumentError{message: "unknown registry: PhoenixApp.PubSub"},
# [
# {Registry, :info!, 1, [file: 'lib/registry.ex', line: 1373]},
# {Registry, :register, 3, [file: 'lib/registry.ex', line: 989]},
# {Phoenix.PubSub, :subscribe, 3, [file: 'lib/phoenix/pubsub.ex', line: 121]},
# {Phoenix.Channel.Server, :init_join, 3, [file: 'lib/phoenix/channel/server.ex', line: 434]},
# {Phoenix.Channel.Server, :channel_join, 4, [file: 'lib/phoenix/channel/server.ex', line: 396]},
# {Phoenix.Channel.Server, :handle_info, 2, [file: 'lib/phoenix/channel/server.ex', line: 305]},
# {:gen_server, :try_handle_info, 3, [file: 'gen_server.erl', line: 1095]},
# {:gen_server, :handle_msg, 6, [file: 'gen_server.erl', line: 1183]},
# {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 241]}
# ]
# },
# ancestors: ["pid id", PhoenixAppWeb.Endpoint.Phoenix.LiveReloader.Socket, PhoenixAppWeb.Endpoint, PhoenixApp.Supervisor, "pid id"],
# message_queue_len: 0,
# messages: [],
# links: ["pid id"],
# dictionary: ["$callers": ["pid id"]],
# trap_exit: false,
# status: :running,
# heap_size: 17731,
# stack_size: 28,
# reductions: 15540
# ],
# []
# ]
# }
%{label: {lib, reason}, report: report} when is_list(report) ->

Check warning on line 414 in lib/sentry/logger_handler.ex

View workflow job for this annotation

GitHub Actions / Test (Elixir 1.13.4-otp-22, OTP 22.3.4)

variable "lib" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 414 in lib/sentry/logger_handler.ex

View workflow job for this annotation

GitHub Actions / Test (Elixir 1.13.4-otp-22, OTP 22.3.4)

variable "reason" is unused (if the variable is not meant to be used, prefix it with an underscore)
error = Enum.find(report, fn {name, _value} -> name == :error_info end)
{_, exception, stacktrace} = error

sentry_opts = Keyword.merge(sentry_opts, stacktrace: stacktrace, handled: false)

capture(:exception, exception, sentry_opts, config)

_ ->
capture(:message, inspect(report), sentry_opts, config)
end
Expand Down
Loading