ecto_dbg icon indicating copy to clipboard operation
ecto_dbg copied to clipboard

[question] using without the *_and_log wrappers

Open glennr opened this issue 1 year ago • 1 comments

Hi!

I couldn't figure out how to use ecto_dbg with Scrivener's paginate/2.

log_query/4 seems like the logical choice, except it gets a bit long winded with the opts (3rd param):

    EctoDbg.log_query(
      Repo,
      :all,
      [
        level: :debug,
        logger_function: {EctoDbg, :default_logger},
        only: [:test, :dev]
      ],
      query
    )

    Repo.paginate(query, opts)

Any guidance/tips would be appreciated. Thanks!

glennr avatar Aug 15 '24 02:08 glennr

I would also like to use ecto_dbg to log queries made by my library dx, which uses dataloader under the hood, so using the *_and_log wrappers is not feasible.

Would it be possible to add an easy-to-use public API version of log_query/4 mentioned by @glennr?

Ideally, this would be compatible and easy to use with the telemetry events emitted by Ecto.

Thanks for considering and making this great library! ❤️

arnodirlam avatar Oct 04 '24 15:10 arnodirlam