From 5b372c8afcc20266c7599e8ae38342dc01e064c8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 1 Oct 2024 18:12:16 +0200 Subject: [PATCH] =?utf8?q?=F0=9F=90=9B=20Keep=20reference=20to=20logger=20?= =?utf8?q?around=20so=20its=20configuration=20isn=E2=80=99t=20lost?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../sone/core/DefaultElementLoaderTest.kt | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) 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 + }) } } -- 2.7.4