Closed bhuntpenn closed 1 year ago
Hey @bhuntpenn
I then install the handler manually, Ecto.DevLogger.install(Brybags.Repo) and everything works fine.
It will work to the next invocation of the query that causes the error :)
I'd go with this:
defimpl Ecto.DevLogger.PrintableParameter, for: [Cheese.Assignments, Cheese.Assignment, Cheese.Member] do
def to_expression(x) , do: to_string_literal(x)
def to_string_literal(x), do: Jason.encode!(Map.from_struct(x))
end
Thanks for the help @fuelen !
@bhuntpenn I just want to add, that there was one small bug with map representation, the end result has to be wrapped in quotes https://github.com/fuelen/ecto_dev_logger/commit/486c2bba192524049f09b9a4794c04be224bbde9 also, the changes you're doing are a result of updating from Ecto 3.9.0 to 3.9.1. Ideally, you wouldn't have to manually convert your structs to JSON. Here is a corresponding issue I raised today https://github.com/elixir-ecto/ecto_sql/issues/463
Hey @bhuntpenn The fix is already in the main ecto_sql branch https://github.com/elixir-ecto/ecto_sql/pull/464
Hi there, I add
Ecto.DevLogger.install(Brybags.Repo)
to myApplication.start/2
callback, and start the application.The following crash is logged to the terminal.
I then install the handler manually,
Ecto.DevLogger.install(Brybags.Repo)
and everything works fine.I was thinking, perhaps I should implement a
PrintableParameter
like such, but doesn't seem to have taken effect (I did edit the dep source code directly, but in any event, I'm not sure what approach I should take).Or would I have to do something like this?
I'm asking because I'm wondering if I can add something to improve first-time user experience, it works fine by manually running
Ecto.DevLogger.install(Brybags.Repo)
- but I'm thinking of the next person.