ex_json_logger v0.1.2 ExJsonLogger.Ecto.Logger
An Ecto Logger replacement which captures and logs Ecto.LogEntry
attributes through metadata.
Logger Metadata available:
- query - the query as string;
- query_params - the query parameters as string;
- query_time - the time spent executing the query in milliseconds;
- decode_time - the time spent decoding the result in milliseconds;
- queue_time - the time spent to check the connection out in milliseconds;
Metadata is filtered by default so keys will need to be whitelisted.
Usage
Add ExJsonLogger.Ecto.Logger
to the Repo’s configuration under the :loggers
key.
config :sample, Sample.Repo,
adapter: Ecto.Adapters.MySQL,
username: "root",
password: "",
database: "sample_dev",
hostname: "localhost",
pool_size: 10,
loggers: [{ExJsonLogger.Ecto.Logger, :log, []}]