Comments (14)
I'm going to be explicit here. I've got an example program: https://github.com/rlipscombe/lager_loc. It uses 'line' in the formatter config for lager_default_formatter
.
When compiled with OTP-23, it logs the following:
2021-06-11 20:05:27.411 [info] <0.119.0>@lager_loc_app:start:13 Hello World!
When compiled with OTP-24.0.2, it logs the following:
2021-06-11 20:08:15.284 [info] <0.118.0>@lager_loc_app:start:{13,5} Hello World!
The column information appears to be the start of the lager
token in lager:info
, so it's potentially useful.
from lager.
This was fixed in #560
from lager.
Should probably also rename Line
to Loc
, but that would be a very noisy diff.
from lager.
Is there some reason why you want to throw away the column information? Or is it that it breaks some kind of reporting tool that you're using?
from lager.
- It looks unusual when formatted as a tuple. For consistency with most other tools, it should be
Line:Col
. For this, the metadata ought to haveline
andcol
attributes. - The column information doesn't mean anything, as far as I can tell, because it's been run through a parse transform.
from lager.
Oh, yes. It also occurs to me that custom backends might be surprised to see a tuple in the 'line' metadata. Consider the cases where they're converting it to a fixed schema that's expecting an integer.
Rollbar, for example (see https://explorer.docs.rollbar.com/#operation/create-item) has separate fields for lineno and colno. So, while it'd be useful to have both in the metadata, having them in the same metadata attribute is likely to break any lager->rollbar backends that currently expect an integer.
from lager.
Following what Erlang did with error_location
, would an option be suitable? This would keep existing behaviour while allowing for opt-in "line only". I'd prefer it if lager
didn't eat up potentially useful info.
from lager.
Oh, yeah, on the other hand, as @rlipscombe states, if the column is wrong it's not useful and could/should be discarded.
from lager.
It's entirely possible that the column is not wrong, and I've just been reading it wrong. If it's useful, I don't want to throw it away.
But: in the interests of not breaking any custom backend, the 'line' metadata should be unchanged. I propose that, on OTP-24, the parse transform, should add a new metadata item 'column' in addition.
from lager.
I agree that if it's considered a breaking change (e.g. a callback signature is spec'ed wrong) AND the column info. is OK, your approach of adding metadata is reasonable.
from lager.
^^ pull request that shows what I'm suggesting.
from lager.
FWIW (even as a fast workaround), you can achieve non-column log by adding {error_location, line}
to your rebar.config
's erl_opts
(I tested this on your lager_loc
repo.), but I do agree separating the two is more useful.
from lager.
{error_location, line}
FWIW(即使作为一种快速的解决方法),您可以通过添加到您rebar.config
的 's来实现非列日志erl_opts
(我在您的lager_loc
repo 上对此进行了测试。),但我同意将两者分开更有用。
If LINE is Tuple type, although it is no problem to generate beam, the use of a function erl_prettypr: format (erl_synntax: form_list (AC)) to code will report an error:
{var,{13,13},'String'},
{atom,{13,2},none},
{integer,{13,2},4096},
{integer,{13,2},64},
{var,{13,2},'__Leveltest113'},
{var,{13,2},'__Tracestest113'},
{atom,{13,2},lager_event},
{var,{13,2},'__Pidtest113'}]}]},
{clause,{13,2},[{var,{13,2},'_'}],[],[{atom,{13,2},ok}]}]}]}]},
{eof,{42,30}}]** exception error: bad argument
in function integer_to_list/1
called as integer_to_list({13,2})
*** argument 1: not an integer
in call from erl_syntax:integer_literal/1 (erl_syntax.erl, line 1699)
in call from erl_prettypr:lay_2/2 (erl_prettypr.erl, line 460)
in call from erl_prettypr:seq/4 (erl_prettypr.erl, line 1437)
in call from erl_prettypr:seq/4 (erl_prettypr.erl, line 1440)
in call from erl_prettypr:lay_2/2 (erl_prettypr.erl, line 475)
in call from erl_prettypr:seq/4 (erl_prettypr.erl, line 1439)
in call from erl_prettypr:seq/4 (erl_prettypr.erl, line 1440)
from lager.
{error_location, line}
FWIW(即使有一种快速的解决方法),您也可以通过添加到您rebar.config
实现的非测试列日志erl_opts
(我在您的lager_loc
回购上进行的)。 。
Convert {Integer, Line, LINE} to
{l, c} = line,
{table, line, [{integer, line, l}, {integer, line, c}]}
Is it a correct way?
from lager.
Related Issues (20)
- Here's a suggestion
- .
- new release HOT 1
- Here's a suggestion HOT 2
- when print record format by lager:pr which has binary value, need space after '='
- Lager with Erl24 HOT 1
- Resolve relative log_root to absolute on boot HOT 1
- variable '__Levelfoo_app13' unsafe in 'case'
- qlc.hrl causes lager to produce "Warning: a term is constructed, but never used" HOT 3
- Upgrade to rebar3 HOT 2
- lager is stuck on lager:do_log_impl HOT 9
- Directory "test" missing in hex.pm package
- Lager process is having a huge queue length HOT 1
- How to get log level in dynamic metadata? HOT 1
- Is this project alive ? HOT 3
- Confusing behaviour with eunit tests
- How about extracting file writing to a process?
- An Invaild integer syntax tuple in lager_transform.erl
- Lager version 3.5.2, issue of excessive memory usage HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lager.