From: David ‘Bombe’ Roden Date: Tue, 1 Oct 2024 16:12:16 +0000 (+0200) Subject: 🐛 Keep reference to logger around so its configuration isn’t lost X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=5b372c8afcc20266c7599e8ae38342dc01e064c8;p=Sone.git 🐛 Keep reference to logger around so its configuration isn’t lost --- diff --git a/src/test/kotlin/net/pterodactylus/sone/core/DefaultElementLoaderTest.kt b/src/test/kotlin/net/pterodactylus/sone/core/DefaultElementLoaderTest.kt index 98a177b..f108371 100644 --- a/src/test/kotlin/net/pterodactylus/sone/core/DefaultElementLoaderTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/core/DefaultElementLoaderTest.kt @@ -236,19 +236,19 @@ class DefaultElementLoaderTest { private val loggedRecords = mutableListOf() - init { - Logger.getLogger(DefaultElementLoader::class.qualifiedName) - .apply { level = ALL } - .apply { - addHandler(object : Handler() { - override fun publish(record: LogRecord) { - loggedRecords += record - } - - override fun flush() = Unit - override fun close() = Unit - }) + @Suppress("unused") + // keep this instance around so its configuration isn’t lost + private val logger = Logger.getLogger(DefaultElementLoader::class.qualifiedName) + .apply { level = ALL } + .apply { + addHandler(object : Handler() { + override fun publish(record: LogRecord) { + loggedRecords += record } + + override fun flush() = Unit + override fun close() = Unit + }) } }