From 31c015dc650d68c1287fafc0cf2cb404d782cc43 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Sun, 15 Dec 2024 22:34:05 +0100 Subject: [PATCH] Add default engine-core channel --- .../kotlin/de/staropensource/engine/base/Engine.kt | 10 ++++++++++ .../staropensource/engine/base/EngineConfiguration.kt | 11 ++++++++++- .../engine/base/type/logging/ChannelSettings.kt | 6 +++--- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/base/src/main/kotlin/de/staropensource/engine/base/Engine.kt b/base/src/main/kotlin/de/staropensource/engine/base/Engine.kt index a98224f..c5f75f0 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/Engine.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/Engine.kt @@ -106,6 +106,10 @@ class Engine private constructor() { /** * Initializes the engine. * + * The request is ignored if the engine + * is bootstrapping itself, initializing, + * shutting down or has crashed fatally. + * * @throws EngineInitializationFailureException on initialization error * @since v1-alpha10 */ @@ -143,6 +147,9 @@ class Engine private constructor() { /** * Shuts the engine down. * + * The request is ignored if + * the engine isn't running. + * * @since v1-alpha10 */ @JvmStatic @@ -162,6 +169,9 @@ class Engine private constructor() { * Shuts the engine down and * terminates the application. * + * The request is ignored if + * the engine isn't running. + * * @since v1-alpha10 */ @JvmStatic 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 3a19212..638b290 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/EngineConfiguration.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/EngineConfiguration.kt @@ -128,7 +128,16 @@ class EngineConfiguration private constructor() { * @since v1-alpha10 */ @JvmStatic - var logChannelSettings: MutableMap = mutableMapOf() + var logChannelSettings: MutableMap = mutableMapOf( + Pair("engine-core", ChannelSettings( + enable = null, + sanitizeMessage = true, + permitFormatting = true, + applicationName = "The StarOpenSource Engine", + formatter = null, + adapters = null + )) + ) /** * Holds all registered [CrashCategory]s diff --git a/base/src/main/kotlin/de/staropensource/engine/base/type/logging/ChannelSettings.kt b/base/src/main/kotlin/de/staropensource/engine/base/type/logging/ChannelSettings.kt index 75a4901..6136a55 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/type/logging/ChannelSettings.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/type/logging/ChannelSettings.kt @@ -43,7 +43,7 @@ data class ChannelSettings( private val permitFormatting: Boolean? = null, private val applicationName: String? = null, private val formatter: Formatter? = null, - private val adapters: Set? = null, + private val adapters: LinkedHashSet? = null, ) { /** * Companion object of [ChannelSettings]. @@ -68,7 +68,7 @@ data class ChannelSettings( * @since v1-alpha10 */ @JvmStatic - val global: ChannelSettings = ChannelSettings( + var global: ChannelSettings = ChannelSettings( enable = null, sanitizeMessage = null, permitFormatting = null, @@ -94,7 +94,7 @@ data class ChannelSettings( "permitFormatting" -> (settings?.permitFormatting ?: global.permitFormatting) != false "applicationName" -> settings?.applicationName ?: global.applicationName ?: "This application" "formatter" -> settings?.formatter ?: global.formatter ?: NoOperationFormatter.instance - "adapters" -> settings?.adapters ?: global.adapters ?: setOf(PrintlnAdapter.instance) + "adapters" -> settings?.adapters ?: global.adapters ?: linkedSetOf(PrintlnAdapter.instance) else -> null } }