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

Support finer grained filtering and lazy evaluation #101

Open
venkatd opened this issue May 16, 2021 · 0 comments
Open

Support finer grained filtering and lazy evaluation #101

venkatd opened this issue May 16, 2021 · 0 comments

Comments

@venkatd
Copy link

venkatd commented May 16, 2021

I have many scenarios where I would like to only turn on a few loggers based and setup custom filtering based on some configuration.

For example, I may just want to filter by API calls and Keyboard shortcuts. The LogLevel system isn't fine grained enough to support this. Right now the filter is handled here in the Logger:

bool isLoggable(Level value) => (value >= level);

One proposal would be to introduce an interface called LogFilter. It would look like:

abstract class LogFilter {
  bool isLoggable(LogRecord record);
}

Then, we could update the signature to:

class Level implements Comparable<Level>, LogFilter {
  // ...
  @override
  bool isLoggable(LogRecord record) => this >= record.level;
  // ...
}

Just a rough idea. Any impact this would have on the current logging implementation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant