Iodata print elixir term as elixir syntax

https://hexdocs.pm/recon_ex/ReconTrace.html#format/1

ReconTrace (taking one example) is a trading library (like all of them) which provides the ability to specify a formatting function which takes an argument tuple and does something with it rather than just tracing to the console.

I’d like to write a formatter that sends the call arguments to a file in a format like this (erlang terms loadable by :file.consult) https://github.com/bryanhuntesl/ex_bench/blob/master/priv/example.consult

Can anyone suggest a good way of formatting that conversats them to a string or iolist in this erlang term format with the least amount of effort?

Just use Erlang pretty printer:

:io_lib.format("~p", [data])