logger_std_h, printing past the group leader.
logger_std_h, printing past the group leader.
Only needed alongside nh_io_capture. logger runs its handlers in the
process that logged, and logger_std_h prints with io:format/2, so with a
capture attached its output is captured as well -- and every line logged
arrives at NervesHub twice, once structured from nh_logger and once as the
text logger_std_h just printed.
This prints the same line with console:print/1, which is what io itself
falls back to when a process has no group leader. Nothing is sent, so the
console shows every log line and NervesHub gets one copy, from nh_logger.
logger_manager:start_link(#{
log_level => info,
logger => [
{handler, default, nh_console_h, #{level => info}},
nh_logger:handler(#{level => info})
]
})
Without a capture attached, logger_std_h does the same job and this is not
worth swapping in.
| handler/0 | Equivalent to handler(#{level => info}).
|
| handler/1 | The handler entry to put in logger_manager's config. |
| log/2 | The logger handler callback. |
handler() -> tuple()
Equivalent to handler(#{level => info}).
handler(Config::map()) -> tuple()
The handler entry to put in logger_manager's config.
default, because that is the slot logger_std_h occupies and
this replaces it. logger_manager adds logger_std_h itself when no handler
claims that id, so an entry under any other name gets both -- and every line
is printed twice.
log(LogEvent::map(), Config::map()) -> ok
The logger handler callback.
Generated by EDoc