From 479c965c1abcc91b9a28d879dd2a3a270bc97236 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Mon, 16 Dec 2024 02:32:50 +0100 Subject: [PATCH] Move LoggerThreadingHandler, support start & stop --- .../de/staropensource/engine/base/EngineConfiguration.kt | 7 ++++++- .../{ => implementable}/logging/LoggerThreadingHandler.kt | 3 ++- .../kotlin/de/staropensource/engine/base/logging/Logger.kt | 1 + .../de/staropensource/engine/base/logging/Processor.kt | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) rename base/src/main/kotlin/de/staropensource/engine/base/{ => implementable}/logging/LoggerThreadingHandler.kt (94%) diff --git a/base/src/main/kotlin/de/staropensource/engine/base/EngineConfiguration.kt b/base/src/main/kotlin/de/staropensource/engine/base/EngineConfiguration.kt index 638b290..4754bcf 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/EngineConfiguration.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/EngineConfiguration.kt @@ -27,7 +27,7 @@ import de.staropensource.engine.base.implementation.logging.KotlinShutdownHandle import de.staropensource.engine.base.implementation.logging.crashcategory.InfoCrashCategory import de.staropensource.engine.base.implementation.logging.formatbuilder.SOSLSv2FormatBuilder import de.staropensource.engine.base.logging.Logger -import de.staropensource.engine.base.logging.LoggerThreadingHandler +import de.staropensource.engine.base.implementable.logging.LoggerThreadingHandler import de.staropensource.engine.base.type.logging.ChannelSettings import de.staropensource.engine.base.type.logging.Feature import de.staropensource.engine.base.type.logging.Level @@ -166,6 +166,11 @@ class EngineConfiguration private constructor() { */ @JvmStatic var logThreadingHandler: LoggerThreadingHandler? = null + set(value) { + logThreadingHandler?.stop() + logThreadingHandler = value + logThreadingHandler?.start() + } /** * Controls the [FormatBuilder] to use. diff --git a/base/src/main/kotlin/de/staropensource/engine/base/logging/LoggerThreadingHandler.kt b/base/src/main/kotlin/de/staropensource/engine/base/implementable/logging/LoggerThreadingHandler.kt similarity index 94% rename from base/src/main/kotlin/de/staropensource/engine/base/logging/LoggerThreadingHandler.kt rename to base/src/main/kotlin/de/staropensource/engine/base/implementable/logging/LoggerThreadingHandler.kt index 6b7a28b..3c4b4af 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/logging/LoggerThreadingHandler.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/implementable/logging/LoggerThreadingHandler.kt @@ -18,8 +18,9 @@ * along with this program. If not, see . */ -package de.staropensource.engine.base.logging +package de.staropensource.engine.base.implementable.logging +import de.staropensource.engine.base.logging.Processor import de.staropensource.engine.base.type.logging.Call /** diff --git a/base/src/main/kotlin/de/staropensource/engine/base/logging/Logger.kt b/base/src/main/kotlin/de/staropensource/engine/base/logging/Logger.kt index c400667..aae90db 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/logging/Logger.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/logging/Logger.kt @@ -21,6 +21,7 @@ package de.staropensource.engine.base.logging import de.staropensource.engine.base.EngineConfiguration +import de.staropensource.engine.base.implementable.logging.LoggerThreadingHandler import de.staropensource.engine.base.type.logging.Call import de.staropensource.engine.base.type.logging.Level import kotlinx.datetime.Clock diff --git a/base/src/main/kotlin/de/staropensource/engine/base/logging/Processor.kt b/base/src/main/kotlin/de/staropensource/engine/base/logging/Processor.kt index 1f20bf8..e620ee5 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/logging/Processor.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/logging/Processor.kt @@ -24,6 +24,7 @@ import de.staropensource.engine.base.EngineConfiguration import de.staropensource.engine.base.implementable.logging.Adapter import de.staropensource.engine.base.implementable.logging.FormatBuilder import de.staropensource.engine.base.implementable.logging.Formatter +import de.staropensource.engine.base.implementable.logging.LoggerThreadingHandler import de.staropensource.engine.base.type.logging.Call import de.staropensource.engine.base.type.logging.ChannelSettings import de.staropensource.engine.base.type.logging.Feature