From 7dced06c58053b78b169d126e8f060bbb7eadd84 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Sun, 29 Dec 2024 23:46:37 +0100 Subject: [PATCH] Rename ThreadingHandler --- .../engine/base/EngineConfiguration.kt | 24 ++++++++++--------- ...hreadingHandler.kt => ThreadingHandler.kt} | 11 ++++----- 2 files changed, 17 insertions(+), 18 deletions(-) rename base/src/main/kotlin/de/staropensource/engine/base/implementable/logging/{LoggerThreadingHandler.kt => ThreadingHandler.kt} (88%) 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 c5f1d7b..fee398e 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/EngineConfiguration.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/EngineConfiguration.kt @@ -20,16 +20,17 @@ package de.staropensource.engine.base import de.staropensource.engine.base.Engine.Companion.logger +import de.staropensource.engine.base.EngineConfiguration.Companion.logThreadingHandler import de.staropensource.engine.base.implementable.ShutdownHandler import de.staropensource.engine.base.implementable.logging.CrashCategory import de.staropensource.engine.base.implementable.logging.FormatBuilder +import de.staropensource.engine.base.implementable.logging.ThreadingHandler import de.staropensource.engine.base.implementation.logging.KotlinShutdownHandler +import de.staropensource.engine.base.implementation.logging.crashcategory.EngineCrashCategory +import de.staropensource.engine.base.implementation.logging.crashcategory.EnvironmentCrashCategory 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.implementable.logging.LoggerThreadingHandler -import de.staropensource.engine.base.implementation.logging.crashcategory.EngineCrashCategory -import de.staropensource.engine.base.implementation.logging.crashcategory.EnvironmentCrashCategory import de.staropensource.engine.base.type.logging.ChannelSettings import de.staropensource.engine.base.type.logging.Feature import de.staropensource.engine.base.type.logging.Level @@ -103,9 +104,10 @@ class EngineConfiguration private constructor() { ) /** - * Controls how fast the [LoggerThreadingHandler] + * Controls how fast the [ThreadingHandler] * shall wait until processing the log queue after - * it has been processed minus the processing time. + * it has been processed minus the processing time + * in milliseconds. * * This only takes effect if [logThreadingHandler] * is not set to `null`. @@ -113,7 +115,7 @@ class EngineConfiguration private constructor() { * @since v1-alpha10 */ @JvmStatic - var logThreadingPollDelay: Int = 5 + var logThreadingPollDelay: ULong = 5u /** * Holds log channel settings. @@ -152,21 +154,21 @@ class EngineConfiguration private constructor() { ) /** - * Controls the [LoggerThreadingHandler] + * Controls the [ThreadingHandler] * to use for logging. * * This determines how multithreading is * handled in the logging system. Set to * `null` for a single-threaded logger. * - * @see LoggerThreadingHandler + * @see ThreadingHandler * @since v1-alpha10 */ @JvmStatic - var logThreadingHandler: LoggerThreadingHandler? = null + var logThreadingHandler: ThreadingHandler? = null set(value) { logThreadingHandler?.stop() - logThreadingHandler = value + field = value logThreadingHandler?.start() } @@ -270,7 +272,7 @@ class EngineConfiguration private constructor() { Feature.ORIGIN, Feature.LINE_NUMBER, ) - "logThreadingPollDelay" -> logThreadingPollDelay = 5 + "logThreadingPollDelay" -> logThreadingPollDelay = 5u "logChannelSettings" -> logChannelSettings = mutableMapOf( Pair("engine-core", ChannelSettings( enable = null, diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementable/logging/LoggerThreadingHandler.kt b/base/src/main/kotlin/de/staropensource/engine/base/implementable/logging/ThreadingHandler.kt similarity index 88% rename from base/src/main/kotlin/de/staropensource/engine/base/implementable/logging/LoggerThreadingHandler.kt rename to base/src/main/kotlin/de/staropensource/engine/base/implementable/logging/ThreadingHandler.kt index 7470ba5..b5f864b 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementable/logging/LoggerThreadingHandler.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/implementable/logging/ThreadingHandler.kt @@ -19,7 +19,6 @@ package de.staropensource.engine.base.implementable.logging -import de.staropensource.engine.base.logging.Processor import de.staropensource.engine.base.type.logging.Call /** @@ -31,7 +30,7 @@ import de.staropensource.engine.base.type.logging.Call * * @since v1-alpha10 */ -interface LoggerThreadingHandler { +interface ThreadingHandler { // -----> Threading management /** * Starts this threading handler. @@ -65,16 +64,14 @@ interface LoggerThreadingHandler { fun queue(call: Call) /** - * Force-processes all queued [Call]s. + * Force-processes all queued [Call]s + * instantly by sending them to + * [de.staropensource.engine.base.logging.Processor.process]. * * This method is blocking and should * only return once all log messages * have been processed and printed. * - * Processing is performed by - * [Processor.process]. Do not perform - * any processing yourself. - * * @since v1-alpha10 */ fun flush()