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

Add ability to filter log entries by range of log levels #5667

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
3 participants
@valfirst
Contributor

valfirst commented Mar 22, 2018


This change is Reviewable

@lmtierney lmtierney added the C-java label May 30, 2018

@shs96c

This comment has been minimized.

Show comment
Hide comment
@shs96c

shs96c Jun 15, 2018

Member

Would it not be nicer to pass in a Predicate<LogEntry>? That way you can just use a normal Java streams to deal with these.

Member

shs96c commented Jun 15, 2018

Would it not be nicer to pass in a Predicate<LogEntry>? That way you can just use a normal Java streams to deal with these.

@shs96c

This comment has been minimized.

Show comment
Hide comment
@shs96c

shs96c Jun 15, 2018

Member

Looking closer, LogEntries.getAll().stream().filter(entry -> true).collect(Collectors.toList()) would allow this, right? And then it becomes easier to add your own filters too.

Member

shs96c commented Jun 15, 2018

Looking closer, LogEntries.getAll().stream().filter(entry -> true).collect(Collectors.toList()) would allow this, right? And then it becomes easier to add your own filters too.

@valfirst

This comment has been minimized.

Show comment
Hide comment
@valfirst

valfirst Jun 15, 2018

Contributor

Would it not be nicer to pass in a Predicate? That way you can just use a normal Java streams to deal with these.

I can make private List<LogEntry> filter(Predicate<LogEntry> logEntryPredicate) public. Or do you propose to do not add methods filtering by levels at all?


The root cause of this PR: I've started using LogEntries, applied filter(Level.WARNING) and expected to get only warnings (who reads javadocs 😄), but I received warnings, errors and etc. So I thought, that it might be useful to have flexible API to get log entries of specified level or level range only, at least users may try to understand difference between overloaded methods.

Contributor

valfirst commented Jun 15, 2018

Would it not be nicer to pass in a Predicate? That way you can just use a normal Java streams to deal with these.

I can make private List<LogEntry> filter(Predicate<LogEntry> logEntryPredicate) public. Or do you propose to do not add methods filtering by levels at all?


The root cause of this PR: I've started using LogEntries, applied filter(Level.WARNING) and expected to get only warnings (who reads javadocs 😄), but I received warnings, errors and etc. So I thought, that it might be useful to have flexible API to get log entries of specified level or level range only, at least users may try to understand difference between overloaded methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment