OTP-24 and lager and line numbers

Roger Lipscombe roger@REDACTED
Fri Jun 11 14:09:08 CEST 2021


On Fri, 11 Jun 2021 at 13:00, Roger Lipscombe <roger@REDACTED> wrote:
> I was hoping not to have to fork lager to deal with this.

I fixed it up in our (already existing) formatter (which wraps
lager_default_formatter):

format(Msg, _Config, Colors) ->
    Msg2 = patch_line_number(Msg),
    lager_default_formatter:format(Msg2, ...).

patch_line_number({lager_msg, Dest, Meta, Sev, DT, TS, M}) ->
    Meta2 = lists:map(
        fun({line, {L, _}}) -> {line, L};
            (Other) -> Other end,
        Meta),
    {lager_msg, Dest, Meta2, Sev, DT, TS, M}.


More information about the erlang-questions mailing list