Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Metadata not used as backend configuration? #161

Open
tolbrino opened this Issue · 2 comments

2 participants

@tolbrino

I recall having seen a note that in 2.0.0 one would be able to pass any metadata into a handler's configuration, allowing the filtering of messages to be logged by the handler.

My use case is that I'd like to classify logs using {class, some_class} and direct the logs to separate files for each class, as well as having a catch_all handler for the rest of the logs.

I might have totally misunderstood the feature since I couldn't find any hint in the code.

@Vagabond
Collaborator

Metadata is passed, yes. Use lager_msg:metadata to extract the lager_metadata from the message sent to the backend in the form of {msg, LagerMsgStructure}.

The main problem with your idea is that lager does not currently support 'negative' tracing, in that you can opt-in to certain messages, but not opt out of them.

@tolbrino

So the built-in file backend doesn't support metadata based filtering. But it would be possible to do so afaict.

What exactly do you mean by negative tracing? The use case were one would want to use a handler for all logs except the ones matching some metadata? (as a catch_all handler would need to do)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.