Custom loglevels aka per module loglevels #71

Closed
wants to merge 4 commits into
from

3 participants

@fenek

My current task at work is to integrate our ejabberd fork with lager and I needed to modify lager so it could provide exactly the same functionality as ejabberd's set_custom function. Tracing feature was not enough as it allowed me only to "lower" loglevel of specific module but I couldn't make it higher than global backend loglevel.
I didn't want to modify existing behaviour of tracing so I added a feature on top of existing solution, which may be some duplicate of tracing functionality but is easier to use and allows to make module loglevel higher.

@erszcz

Can we count on this being merged upstream?
The pull request's been hanging here for a while without any comment. Is it just because of lack of time/manpower for merging or some issue with the proposed changes?
In case of the latter please let us know, we will be happy to fix them (or the other way around -- just say it's rejected and why).
Thanks in advance!

@Vagabond

Manpower is the main holdup. I haven't had the time to understand what this code is trying to do, as I'm unfamiliar with the set_custom feature of ejabberd.

From my reading of this code, you can set a loglevel 'per module' and it can be higher or lower than the loglevel for a particular backend? So you can log messages from 'my_module' at debug to a file, OR ignore any messages below 'error' for that module?

I think this functionality is good, but I'm not sure of the approach yet. Also, the work over in PR #74 should make module-level filtering easier at the backend, because all metadata is passed in as data, not as a big preformatted string, so I've been working to get that merged in before addressing this.

Sorry for going dark on you. We'll get this functionality merged, one way or another.

Andrew

@Vagabond

Crap, looks like the reply I thought I made on this never got posted:

Now that PR #74 is merged, and things like 'module' are sent to the backend as metadata, can you adapt your patch to use that source of information instead? It should make your patch quite a bit smaller.

@fenek

Sure, I'll take a look at it soon I hope.

@Vagabond

Can you look at #95 and see if it meets your needs, you can now do traces like this:

lager:trace_console([{module, my_module}], '<error')

Which would print any messages from 'my_module' to the console that were less than 'error'.

@Vagabond

Closing due to inactivity.

@Vagabond Vagabond closed this Mar 18, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment