diff --git a/app/src/main/java/com/dp/logcatapp/fragments/logcatlive/LogcatLiveFragment.kt b/app/src/main/java/com/dp/logcatapp/fragments/logcatlive/LogcatLiveFragment.kt index c493d4b..da65c44 100644 --- a/app/src/main/java/com/dp/logcatapp/fragments/logcatlive/LogcatLiveFragment.kt +++ b/app/src/main/java/com/dp/logcatapp/fragments/logcatlive/LogcatLiveFragment.kt @@ -752,6 +752,11 @@ class LogcatLiveFragment : BaseFragment(), ServiceConnection, LogsReceivedListen private class LogFilter(filterInfo: FilterInfo) : Filter { private val type = filterInfo.type private val content = filterInfo.content + private val priorities: Set = if (type == FilterType.LOG_LEVELS) { + filterInfo.content.split(",").toSet() + } else { + emptySet() + } override fun apply(log: Log): Boolean { if (content.isEmpty()) { @@ -759,7 +764,9 @@ class LogcatLiveFragment : BaseFragment(), ServiceConnection, LogsReceivedListen } return when (type) { - FilterType.LOG_LEVELS -> log.priority == content + FilterType.LOG_LEVELS -> { + log.priority in priorities + } FilterType.KEYWORD -> log.msg.containsIgnoreCase(content) FilterType.TAG -> log.tag.containsIgnoreCase(content) FilterType.PID -> log.pid.containsIgnoreCase(content) diff --git a/logcat/src/main/java/com/dp/logcat/Logcat.kt b/logcat/src/main/java/com/dp/logcat/Logcat.kt index b6be0a4..f7191b6 100644 --- a/logcat/src/main/java/com/dp/logcat/Logcat.kt +++ b/logcat/src/main/java/com/dp/logcat/Logcat.kt @@ -104,7 +104,9 @@ class Logcat(initialCapacity: Int = INITIAL_LOG_CAPACITY) : Closeable { logs.add(pendingLogs) val filteredLogs = pendingLogs.filter { e -> - !exclusions.values.any { it.apply(e) } && filters.values.all { it.apply(e) } + !exclusions.values.any { it.apply(e) } + }.filter { e -> + filters.values.all { it.apply(e) } } if (filteredLogs.isNotEmpty()) {