[erlang-questions] lager/io:format and sets

Cian Synnott cian@REDACTED
Tue Nov 11 02:13:47 CET 2014


On Tue, Nov 11, 2014 at 12:02 AM, Oleg Tsarev <oleg@REDACTED> wrote:
> How I can fix the output of the set in lager and io:format?
>
I don't see a "built in" way to fix this. To roll your own, you could
"patch over" the record with sets:to_list/1 to make a printable
version. E.g. something like

printable(#state{channel_id_set=Set}=State) ->
  State#state{channel_id_set=sets:to_list(Set)}.

lager:debug("args ~p, state ~p", [Args, lager:pr(printable(State), ?MODULE)),

It's not super. You might need to change the record's type annotations
to avoid upsetting Dialyzer.

Cian



More information about the erlang-questions mailing list