Ecto v3.0.8 Ecto.LogEntry View Source

Struct used for logging entries.

It is composed of the following fields:

  • query - the query as string;
  • source - the query data source;
  • params - the query parameters;
  • result - the query result as an :ok or :error tuple;
  • query_time - the time spent executing the query in native units;
  • decode_time - the time spent decoding the result in native units (it may be nil);
  • queue_time - the time spent to check the connection out in native units (it may be nil);
  • connection_pid - the connection process that executed the query;
  • ansi_color - the color that should be used when logging the entry.

Notice all times are stored in native unit. You must convert them to the proper unit by using System.convert_time_unit/3 before logging.

Note: Ecto.LogEntry is currently soft-deprecated and will be hard-deprecated in 3.1.x. Instead you should use “Telemetry Events” (as documented in the Ecto.Repo docs)

Link to this section Summary


Logs the given entry in the given level

Converts a log entry into iodata

Link to this section Types

Link to this type t() View Source
t() :: %Ecto.LogEntry{
  decode_time: integer() | nil,
  params: [term()],
  query: String.t(),
  query_time: integer() | nil,
  queue_time: integer() | nil,
  result: {:ok, term()} | {:error, Exception.t()},
  source: String.t() | Enum.t() | nil

Link to this section Functions

Link to this function log(entry, level \\ :debug, metadata \\ []) View Source

Logs the given entry in the given level.

The logger call won’t be removed at compile time as custom level is given.

Converts a log entry into iodata.