Migrating to Logger

Andreas Schultz andreas.schultz@REDACTED
Wed May 27 12:10:37 CEST 2020


Am Mi., 27. Mai 2020 um 10:52 Uhr schrieb Vance Shipley <vances@REDACTED
>:

> Is there a built in method to port this simple behaviour to the new logger?
>
> 1> error_logger:info_report(["Something happened", {state, active}]).
> ok
> =INFO REPORT==== 27-May-2020::16:47:11.797398 ===
>     "Something happened"
>     state: active
>

The format of a report in logger differs from error_logger. Maybe
something like this:

$ erl
Erlang/OTP 23 [erts-11.0] [source] [64-bit] [smp:12:12] [ds:12:12:10]
[async-threads:1]

Eshell V11.0  (abort with ^G)
1> logger:set_primary_config(#{level => info}).
ok
2> logger:info([{msg, "Something happened"}, {state, active}]).
=INFO REPORT==== 27-May-2020::12:08:54.987946 ===
    msg: Something happened
    state: active
ok
3> logger:info(#{msg => "Something happened", state => active}).
=INFO REPORT==== 27-May-2020::12:09:10.560152 ===
    msg: Something happened
    state: active
ok
4>

Andreas


> --
>      -Vance
>


-- 

Andreas Schultz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20200527/7ff0beff/attachment.htm>


More information about the erlang-questions mailing list