Rename ThreadingHandler
This commit is contained in:
parent
bd0879e1cc
commit
7dced06c58
2 changed files with 17 additions and 18 deletions
|
@ -20,16 +20,17 @@
|
||||||
package de.staropensource.engine.base
|
package de.staropensource.engine.base
|
||||||
|
|
||||||
import de.staropensource.engine.base.Engine.Companion.logger
|
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.ShutdownHandler
|
||||||
import de.staropensource.engine.base.implementable.logging.CrashCategory
|
import de.staropensource.engine.base.implementable.logging.CrashCategory
|
||||||
import de.staropensource.engine.base.implementable.logging.FormatBuilder
|
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.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.crashcategory.InfoCrashCategory
|
||||||
import de.staropensource.engine.base.implementation.logging.formatbuilder.SOSLSv2FormatBuilder
|
import de.staropensource.engine.base.implementation.logging.formatbuilder.SOSLSv2FormatBuilder
|
||||||
import de.staropensource.engine.base.logging.Logger
|
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.ChannelSettings
|
||||||
import de.staropensource.engine.base.type.logging.Feature
|
import de.staropensource.engine.base.type.logging.Feature
|
||||||
import de.staropensource.engine.base.type.logging.Level
|
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
|
* 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]
|
* This only takes effect if [logThreadingHandler]
|
||||||
* is not set to `null`.
|
* is not set to `null`.
|
||||||
|
@ -113,7 +115,7 @@ class EngineConfiguration private constructor() {
|
||||||
* @since v1-alpha10
|
* @since v1-alpha10
|
||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
var logThreadingPollDelay: Int = 5
|
var logThreadingPollDelay: ULong = 5u
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds log channel settings.
|
* Holds log channel settings.
|
||||||
|
@ -152,21 +154,21 @@ class EngineConfiguration private constructor() {
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controls the [LoggerThreadingHandler]
|
* Controls the [ThreadingHandler]
|
||||||
* to use for logging.
|
* to use for logging.
|
||||||
*
|
*
|
||||||
* This determines how multithreading is
|
* This determines how multithreading is
|
||||||
* handled in the logging system. Set to
|
* handled in the logging system. Set to
|
||||||
* `null` for a single-threaded logger.
|
* `null` for a single-threaded logger.
|
||||||
*
|
*
|
||||||
* @see LoggerThreadingHandler
|
* @see ThreadingHandler
|
||||||
* @since v1-alpha10
|
* @since v1-alpha10
|
||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
var logThreadingHandler: LoggerThreadingHandler? = null
|
var logThreadingHandler: ThreadingHandler? = null
|
||||||
set(value) {
|
set(value) {
|
||||||
logThreadingHandler?.stop()
|
logThreadingHandler?.stop()
|
||||||
logThreadingHandler = value
|
field = value
|
||||||
logThreadingHandler?.start()
|
logThreadingHandler?.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +272,7 @@ class EngineConfiguration private constructor() {
|
||||||
Feature.ORIGIN,
|
Feature.ORIGIN,
|
||||||
Feature.LINE_NUMBER,
|
Feature.LINE_NUMBER,
|
||||||
)
|
)
|
||||||
"logThreadingPollDelay" -> logThreadingPollDelay = 5
|
"logThreadingPollDelay" -> logThreadingPollDelay = 5u
|
||||||
"logChannelSettings" -> logChannelSettings = mutableMapOf(
|
"logChannelSettings" -> logChannelSettings = mutableMapOf(
|
||||||
Pair("engine-core", ChannelSettings(
|
Pair("engine-core", ChannelSettings(
|
||||||
enable = null,
|
enable = null,
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
package de.staropensource.engine.base.implementable.logging
|
package de.staropensource.engine.base.implementable.logging
|
||||||
|
|
||||||
import de.staropensource.engine.base.logging.Processor
|
|
||||||
import de.staropensource.engine.base.type.logging.Call
|
import de.staropensource.engine.base.type.logging.Call
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,7 +30,7 @@ import de.staropensource.engine.base.type.logging.Call
|
||||||
*
|
*
|
||||||
* @since v1-alpha10
|
* @since v1-alpha10
|
||||||
*/
|
*/
|
||||||
interface LoggerThreadingHandler {
|
interface ThreadingHandler {
|
||||||
// -----> Threading management
|
// -----> Threading management
|
||||||
/**
|
/**
|
||||||
* Starts this threading handler.
|
* Starts this threading handler.
|
||||||
|
@ -65,16 +64,14 @@ interface LoggerThreadingHandler {
|
||||||
fun queue(call: Call)
|
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
|
* This method is blocking and should
|
||||||
* only return once all log messages
|
* only return once all log messages
|
||||||
* have been processed and printed.
|
* have been processed and printed.
|
||||||
*
|
*
|
||||||
* Processing is performed by
|
|
||||||
* [Processor.process]. Do not perform
|
|
||||||
* any processing yourself.
|
|
||||||
*
|
|
||||||
* @since v1-alpha10
|
* @since v1-alpha10
|
||||||
*/
|
*/
|
||||||
fun flush()
|
fun flush()
|
Loading…
Reference in a new issue