OTP-24 and lager and line numbers
Roger Lipscombe
roger@REDACTED
Fri Jun 11 15:53:57 CEST 2021
I've filed https://github.com/erlang-lager/lager/issues/558
On Fri, 11 Jun 2021 at 14:20, Tristan Sloughter <t@REDACTED> wrote:
>
> Should open an issue with lager since they have merged some PRs that were meant to fix this but must not have worked https://github.com/erlang-lager/lager/issues/555
>
> And try 3.9.0 since that appears to be the first release with OTP-24 fixes and maybe it broke in the following changes.
>
> On Fri, Jun 11, 2021, at 06:00, Roger Lipscombe wrote:
> > On Thu, 10 Jun 2021 at 20:14, Roger Lipscombe <roger@REDACTED> wrote:
> > >
> > > I'm migrating a large project to OTP-24.x, and it seems that my line
> > > numbers are tuples by the time they appear in my logs.
> > >
> > > How best to work around this? We're not in a position to rip out lager
> > > just yet. Using lager 3.9.2.
> >
> > Let me restate the problem:
> >
> > When compiling with OTP-24, if I use (e.g.) lager:info("Hello World!")
> > in my code, the lager_default_formatter expands 'line' to a tuple. The
> > first value is the line number; I don't know what the second value is.
> > In theory, it's the column number, but it doesn't correlate with
> > anything obvious, and I suspect that it's been messed up by lager's
> > parse transform anyway.
> >
> > In OTP-23, 'line' would have been the integer line number.
> >
> > The problem appears to be that where OTP-23's AST (as passed to the
> > parse transform) would have had an integer for the line number, OTP-24
> > passes a tuple[1] of {Line, Col}. lager, for better or worse,
> > passes[2] this all the way through to the logging backend (and thus
> > formatter), which just spits it straight out.
> >
> > I was hoping not to have to fork lager to deal with this.
> >
> > [1] Using beam_lib:chunks to look at the abstract_code chunk, I see a
> > tuple for the location.
> > [2] If I add some is_integer guards to the parse transform, it fails
> > as expected.
> >
More information about the erlang-questions
mailing list