Good morning!
I’d like to make it easier to correlate Ecto log output from queries that were ran for a given web request, back to the place where that query was sourced.
When a query is realized (i.e. Repo.all(my_query)
), is there a way to add some metadata to Ecto’s log output?
I don’t want to do a separate log call (i.e. Logger.info("Ran my_query")
) as a bunch of these could come out at varying times and be tough to correlate.
I was hoping there’d be something like this: Repo.all(my_query, label: "My great query")
which would spit out My great query
right inline with the Ecto logs that say Source; XYZ, database: 0.6ms, decode: 0.8ms
etc.