View Source Ecto.DevLogger (ecto_dev_logger v0.4.0)

An alternative logger for Ecto queries.

It inlines bindings into the query, so it is easy to copy-paste logged SQL and run it in any IDE for debugging without manual transformation of common elixir terms to string representation (binary UUID, DateTime, Decimal, json, etc). Also, it highlights db time to make slow queries noticeable. Source table and inlined bindings are highlighted as well.

Link to this section Summary

Functions

Gets the handler_id for a given Repo.

Detaches a previously attached handler for a given Repo.

Link to this section Functions

@spec handler_id(repo_module :: module()) :: list()

Gets the handler_id for a given Repo.

Link to this function

install(repo_module, opts \\ [])

View Source
@spec install(repo_module :: module(), opts :: Keyword.t()) ::
  :ok | {:error, :already_exists}

Attaches telemetry_handler/4 to application.

Returns the result from the call to :telemetry.attach/4 or :ok if the repo has default logging enabled.

options

Options

  • :log_repo_name - When truthy will add the repo name into the log
Link to this function

telemetry_handler(event_name, measurements, metadata, config)

View Source

Telemetry handler which logs queries.

@spec uninstall(repo_module :: module()) :: :ok | {:error, :not_found}

Detaches a previously attached handler for a given Repo.

Returns the result from the call to :telemetry.detach/1