:logger handler behind Harlock.Sub.logger/1, plus the helper for turning a
delivered entry into text.
The subscription delivers entries as maps:
%{level: :warning, msg: raw_msg, meta: metadata}msg is Erlang's raw message term — {:string, chardata}, {:report, map},
or a {format, args} pair. It arrives unformatted on purpose: formatting
allocates, and a log handler runs inside the process that called
Logger.warning/1, so formatting there bills the caller for your UI. Call
text/1 from update/2 instead, where the cost lands on the runtime:
def update({:log, entry}, m) do
line = Harlock.Sub.Logger.text(entry)
%{m | lines: [line | m.lines]}
end
Summary
Functions
Render a delivered entry's message as a binary.
Types
@type entry() :: %{level: :logger.level(), msg: term(), meta: map()}
A delivered log entry: the level, Erlang's raw message term, and metadata.
Functions
Render a delivered entry's message as a binary.
Handles all three shapes Erlang's :logger produces: {:string, chardata},
{:report, term}, and {format, args}. Call this on the runtime side rather
than in a transform — a transform runs in the process that logged.