Skip to content

Document :log_stacktrace_mfa #4597

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

Merged
merged 2 commits into from
Apr 3, 2025
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
12 changes: 11 additions & 1 deletion lib/ecto/repo.ex
Original file line number Diff line number Diff line change
@@ -64,9 +64,19 @@ defmodule Ecto.Repo do
use the `:repo` property in the event metadata for distinguishing
between repos.

* `:stacktrace`- when true, publishes the stacktrace in telemetry events
* `:stacktrace`- when `true`, publishes the stacktrace in telemetry events
and allows more advanced logging.

* `:log_stacktrace_mfa` - A `{module, function, arguments}` tuple that customizes
which part of the stacktrace is included in query logs. The specified function
must accept at least two arguments (stacktrace and metadata) and return
a filtered stacktrace. The metadata is a map with keys such as `:repo` and other
adapter specific information. Additional arguments can be passed in the third
element of the tuple. For `Ecto.Adapters.SQL`, defaults to
`{Ecto.Adapters.SQL, :first_non_ecto_stacktrace, [1]}`, which filters the
stacktrace to show only the first call originating from outside
Ecto's internal code. Only relevant when `:stacktrace` is `true`.

## URLs

Repositories by default support URLs. For example, the configuration
Loading