How to log a map/struct in elixir
The Elixir way of writing arathunku's answer would be using the pipe syntax:
iex(3)> %{a: 1} |> inspect() |> Logger.debug()
23:20:30.265 [debug] %{a: 1}
:ok
You can use inspect/2
- https://hexdocs.pm/elixir/Kernel.html#inspect/2
It parses the data structure into an algebra document which can be printed with the logger.
iex(4)> Logger.debug inspect(%{a: 1})
08:47:32.776 [debug] %{a: 1}
:ok