Add default engine-core channel

This commit is contained in:
JeremyStar™ 2024-12-15 22:34:05 +01:00
parent a655dec583
commit 31c015dc65
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
3 changed files with 23 additions and 4 deletions

View file

@ -106,6 +106,10 @@ class Engine private constructor() {
/** /**
* Initializes the engine. * 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 * @throws EngineInitializationFailureException on initialization error
* @since v1-alpha10 * @since v1-alpha10
*/ */
@ -143,6 +147,9 @@ class Engine private constructor() {
/** /**
* Shuts the engine down. * Shuts the engine down.
* *
* The request is ignored if
* the engine isn't running.
*
* @since v1-alpha10 * @since v1-alpha10
*/ */
@JvmStatic @JvmStatic
@ -162,6 +169,9 @@ class Engine private constructor() {
* Shuts the engine down and * Shuts the engine down and
* terminates the application. * terminates the application.
* *
* The request is ignored if
* the engine isn't running.
*
* @since v1-alpha10 * @since v1-alpha10
*/ */
@JvmStatic @JvmStatic

View file

@ -128,7 +128,16 @@ class EngineConfiguration private constructor() {
* @since v1-alpha10 * @since v1-alpha10
*/ */
@JvmStatic @JvmStatic
var logChannelSettings: MutableMap<String, ChannelSettings> = mutableMapOf() var logChannelSettings: MutableMap<String, ChannelSettings> = mutableMapOf(
Pair("engine-core", ChannelSettings(
enable = null,
sanitizeMessage = true,
permitFormatting = true,
applicationName = "The StarOpenSource Engine",
formatter = null,
adapters = null
))
)
/** /**
* Holds all registered [CrashCategory]s * Holds all registered [CrashCategory]s

View file

@ -43,7 +43,7 @@ data class ChannelSettings(
private val permitFormatting: Boolean? = null, private val permitFormatting: Boolean? = null,
private val applicationName: String? = null, private val applicationName: String? = null,
private val formatter: Formatter? = null, private val formatter: Formatter? = null,
private val adapters: Set<Adapter>? = null, private val adapters: LinkedHashSet<Adapter>? = null,
) { ) {
/** /**
* Companion object of [ChannelSettings]. * Companion object of [ChannelSettings].
@ -68,7 +68,7 @@ data class ChannelSettings(
* @since v1-alpha10 * @since v1-alpha10
*/ */
@JvmStatic @JvmStatic
val global: ChannelSettings = ChannelSettings( var global: ChannelSettings = ChannelSettings(
enable = null, enable = null,
sanitizeMessage = null, sanitizeMessage = null,
permitFormatting = null, permitFormatting = null,
@ -94,7 +94,7 @@ data class ChannelSettings(
"permitFormatting" -> (settings?.permitFormatting ?: global.permitFormatting) != false "permitFormatting" -> (settings?.permitFormatting ?: global.permitFormatting) != false
"applicationName" -> settings?.applicationName ?: global.applicationName ?: "This application" "applicationName" -> settings?.applicationName ?: global.applicationName ?: "This application"
"formatter" -> settings?.formatter ?: global.formatter ?: NoOperationFormatter.instance "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 else -> null
} }
} }