diff --git a/app/src/main/java/de/kuschku/quasseldroid_ng/ui/MainActivity.kt b/app/src/main/java/de/kuschku/quasseldroid_ng/ui/MainActivity.kt index 93f8a9a3cc88b3ed9601d6b7e6e60efed560f4cf..839a930ec85793d26d9e04dc0bd3a7b14b71395c 100644 --- a/app/src/main/java/de/kuschku/quasseldroid_ng/ui/MainActivity.kt +++ b/app/src/main/java/de/kuschku/quasseldroid_ng/ui/MainActivity.kt @@ -58,8 +58,6 @@ class MainActivity : ServiceBoundActivity() { private val dateTimeFormatter: DateTimeFormatter = DateTimeFormatter.ISO_TIME private val handler = object : LoggingHandler() { override fun log(logLevel: LogLevel, tag: String, message: String?, throwable: Throwable?) { - if (logLevel.ordinal < LogLevel.INFO.ordinal) - return val time = dateTimeFormatter.format(ZonedDateTime.now(ZoneOffset.UTC)) runOnUiThread { errorList.append("$time $tag: ") @@ -74,7 +72,8 @@ class MainActivity : ServiceBoundActivity() { } } - override fun isLoggable(logLevel: LogLevel, tag: String) = true + override fun isLoggable(logLevel: LogLevel, tag: String) + = (logLevel.ordinal >= LogLevel.INFO.ordinal) } override fun onCreate(savedInstanceState: Bundle?) { diff --git a/lib/src/main/java/de/kuschku/libquassel/util/compatibility/LoggingHandler.kt b/lib/src/main/java/de/kuschku/libquassel/util/compatibility/LoggingHandler.kt index 1ab563f8a4bc81cd3978481ba6785b62abad0593..261b46ea0ac7eb53f5109dd0883adb2e8321efcf 100644 --- a/lib/src/main/java/de/kuschku/libquassel/util/compatibility/LoggingHandler.kt +++ b/lib/src/main/java/de/kuschku/libquassel/util/compatibility/LoggingHandler.kt @@ -37,9 +37,9 @@ abstract class LoggingHandler { inline fun log(logLevel: LoggingHandler.LogLevel, tag: String, message: String? = null, throwable: Throwable? = null) { - for (it in LoggingHandler.loggingHandlers) { - it.log(logLevel, tag, message, throwable) - } + LoggingHandler.loggingHandlers + .filter { it.isLoggable(logLevel, tag) } + .forEach { it.log(logLevel, tag, message, throwable) } } inline fun log(logLevel: LoggingHandler.LogLevel, tag: String, throwable: Throwable? = null)