[erlang-questions] R21 logger mangles map messages
Siri Hansen
erlangsiri@REDACTED
Mon Aug 13 15:55:15 CEST 2018
Great! I'm currently testing an improved single_line implementation in
logger_formatter, which modifies the field width to 0 for all ~p/~P in the
format strings before replacing the rest of the newlines by ", " as before.
It will be included in OTP-21.1.
/siri
Den fre. 10. aug. 2018 kl. 21:27 skrev Mark Geib <mark.geib.44@REDACTED>:
> So the combination of single_line => true, and the ~0p format field gives
> me what I want.
> Thanks.
>
> On Aug 10, 2018, at 3:07 AM, Siri Hansen <erlangsiri@REDACTED> wrote:
>
>
>
> Den tor. 9. aug. 2018 kl. 16:42 skrev Mark Geib <mark.geib.44@REDACTED>:
>
>> Yes that removed the extra commas. Of course now the log messages are
>> multi-line.
>>
>> So to get a single line message for maps, without the commas, is the only
>> approach to format the message with something like
>> io_lib:print(MyBigMap,1,8192,-1) and then log the string?
>>
>
> Yes, or you could specify field with 0 with ~p to indicate infinite line
> length, e.g.
>
> logger:notice("my map: ~0p",[MyMap])
>
> (Using the value 0 here is new from OTP-21, see the description of control
> sequence 'p' in the ref.man for io:format.)
>
> I do, however, see this a bug in logger. It needs to be a bit more
> sophisticated when ensuring single line - I'm looking into it.
>
> Regards
> /siri
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180813/b5f6c333/attachment.htm>
More information about the erlang-questions
mailing list