From 8601762a10451fffa3dbb708b75b5bfecbf8b476 Mon Sep 17 00:00:00 2001 From: v0idpwn Date: Sun, 30 Mar 2025 16:54:49 -0300 Subject: [PATCH 1/2] Document `:log_stacktrace_mfa` --- lib/ecto/repo.ex | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/ecto/repo.ex b/lib/ecto/repo.ex index 6abf419d2a..6cdd17f2a9 100644 --- a/lib/ecto/repo.ex +++ b/lib/ecto/repo.ex @@ -64,9 +64,18 @@ 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 (a stacktrace and the repo module) and return + a filtered stacktrace. 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 From 9f2ae033ee2a892e48343557e8f8450190fe980b Mon Sep 17 00:00:00 2001 From: felipe stival <14948182+v0idpwn@users.noreply.github.com> Date: Tue, 1 Apr 2025 16:09:08 -0300 Subject: [PATCH 2/2] Document API change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: José Valim --- lib/ecto/repo.ex | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/ecto/repo.ex b/lib/ecto/repo.ex index 6cdd17f2a9..dd22b107ab 100644 --- a/lib/ecto/repo.ex +++ b/lib/ecto/repo.ex @@ -69,9 +69,10 @@ defmodule Ecto.Repo do * `: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 (a stacktrace and the repo module) and return - a filtered stacktrace. Additional arguments can be passed in the third element - of the tuple. For `Ecto.Adapters.SQL`, defaults to + 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`.