I tend to not remember how this is done, so here goes, for easier copy-paste effect:
:recon_trace.calls(
{_mod = HTTPoison, _fun = :request, fn ([_, _, _, _, _]) -> :return_trace end},
_calls = 10,
[scope: :local,
formatter: fn (tuple) ->
# this must return iodata()
case tuple do
{:trace, _pid, :call, {_mod, _fun, [_, url, _, _, _]}} ->
IO.inspect({:call, url}, limit: :infinity)
{:trace, _pid, :return_from, {_mod, _fun, _arity = 5}, {:ok, return_value}} ->
IO.inspect({:return_from, return_value.body}, limit: :infinity)
_other ->
:ok
end
""
end]
)