Merge pull request #11038 from GoossensMichael/patch-1

Also consider string interpolation
This commit is contained in:
Loredana Crusoveanu 2021-08-22 19:13:08 +03:00 committed by GitHub
commit b180037cdc
1 changed files with 3 additions and 3 deletions

View File

@ -19,7 +19,7 @@ public class MemoryAppender extends ListAppender<ILoggingEvent> {
public boolean contains(String string, Level level) { public boolean contains(String string, Level level) {
return this.list.stream() return this.list.stream()
.anyMatch(event -> event.getMessage().toString().contains(string) .anyMatch(event -> event.toString().contains(string)
&& event.getLevel().equals(level)); && event.getLevel().equals(level));
} }
@ -30,13 +30,13 @@ public class MemoryAppender extends ListAppender<ILoggingEvent> {
public List<ILoggingEvent> search(String string) { public List<ILoggingEvent> search(String string) {
return this.list.stream() return this.list.stream()
.filter(event -> event.getMessage().toString().contains(string)) .filter(event -> event.toString().contains(string))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
public List<ILoggingEvent> search(String string, Level level) { public List<ILoggingEvent> search(String string, Level level) {
return this.list.stream() return this.list.stream()
.filter(event -> event.getMessage().toString().contains(string) .filter(event -> event.toString().contains(string)
&& event.getLevel().equals(level)) && event.getLevel().equals(level))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }