Skip to content
Merged
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
6 changes: 5 additions & 1 deletion lib/sentry.ex
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,14 @@ defmodule Sentry do
`MyModule` could look like this:

defmodule MyModule do
@spec before_send(Sentry.Event.t()) :: Sentry.Event.t()
def before_send(event) do
metadata = Map.new(Logger.metadata())
%Sentry.Event{event | extra: Map.merge(event.extra, metadata)}
end

def after_send_event(event, result) do
@spec after_send(Sentry.Event.t(), {:ok, String.t()} | {:error, any()}) :: any()
def after_send(event, result) do
case result do
{:ok, id} ->
Logger.info("Successfully sent event!")
Expand All @@ -145,6 +147,8 @@ defmodule Sentry do
end
end

If the `before_send` callback returns `nil` or `false`, the event is not reported.

## Reporting Source Code

Sentry supports reporting the source code of (and around) the line that
Expand Down
Loading