View Source LoggerJSON.Ecto (logger_json v5.1.4)

Implements the behaviour of Ecto.LogEntry and sends query as a string to Logger with additional metadata:

  • query.execution_time_μs - the time spent executing the query in microseconds;
  • query.decode_time_μs - the time spent decoding the result in microseconds (it may be 0);
  • query.queue_time_μs - the time spent to check the connection out in microseconds (it may be 0);
  • query.duration_μs - time the query taken (sum of query_time, decode_time and queue_time);
  • connection_pid - the connection process that executed the query;
  • ansi_color - the color that should be used when logging the entry.

For more information see LogEntry source code.

Summary

Functions

Logs query string with metadata from Ecto.LogEntry in with debug level.

Overwritten to use JSON.

Functions

@spec log(entry :: map()) :: map()

Logs query string with metadata from Ecto.LogEntry in with debug level.

@spec log(entry :: map(), level :: Logger.level()) :: map()

Overwritten to use JSON.

Logs the given entry in the given level.

Link to this function

telemetry_logging_handler(event_name, time, map, level)

View Source
@spec telemetry_logging_handler(
  event_name :: [atom()],
  query_time :: %{
    query_time: non_neg_integer(),
    queue_time: non_neg_integer(),
    decode_time: non_neg_integer(),
    total_time: non_neg_integer()
  },
  log_entry :: map(),
  level :: Logger.level()
) :: :ok