Ecto v2.0.0-beta.2 Ecto.LogEntry

Summary

Functions

Struct used for logging entries

Logs the given entry in debug mode

Logs the given entry in the given level

Converts a log entry into iodata

Types

t :: %Ecto.LogEntry{connection_pid: pid | nil, decode_time: integer | nil, params: [term], query: String.t | (t -> String.t), query_time: integer, queue_time: integer | nil, result: {:ok, term} | {:error, Exception.t}}

Functions

__struct__()

Struct used for logging entries.

It is composed of the following fields:

  • query - the query as string or a function that when invoked resolves to string;
  • params - the query parameters;
  • result - the query result as an :ok or :error tuple;
  • query_time - the time spent executing the query in microseconds;
  • decode_time - the time spent decoding the result in microseconds (it may be nil);
  • queue_time - the time spent to check the connection out in microseconds (it may be nil);
  • connection_pid - the connection process that executed the query
log(entry)

Logs the given entry in debug mode.

The logger call will be removed at compile time if compile_time_purge_level is set to higher than debug.

log(entry, level)

Logs the given entry in the given level.

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

to_iodata(entry)

Converts a log entry into iodata.

The entry is automatically resolved if it hasn’t been yet.