Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve log filter predicates #364

ckreibich opened this issue May 13, 2019 · 0 comments


None yet
2 participants
Copy link

commented May 13, 2019

In the logging framework streams and filters have nice APIs to create/update/remove them. Predicate functions in filters have no such API, and there are two main difficulties in using them in practice:

(1) It's tedious to write code that is aware of any already existing predicates on a filter. You basically have to check whether the filter has a predicate member, and if so, try to chain it to a new predicate. It's also easy to forget to do this, and in turn blow away an existing predicate.

(2) Predicate functions only receive the log record they decide on, and no other state. This makes it harder to write stateful predicates. (Others have already pointed out that closures would also be a nice way to handle this.)

So it would be nice to structure this more, for example by having a management API for predicates that properly supports multiple predicates and how to chain them. I also like the idea of a state pointer for the predicates themselves. (I believe we've recently also touched the possibility of optional function arguments / overloading function signatures.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.