Add AnsiSubsystem.makeFormattingDefault
This commit is contained in:
parent
246e83c27d
commit
ee23d7739d
2 changed files with 16 additions and 0 deletions
|
@ -22,6 +22,7 @@ package de.staropensource.engine.ansi
|
||||||
import de.staropensource.engine.base.Engine
|
import de.staropensource.engine.base.Engine
|
||||||
import de.staropensource.engine.base.implementable.Subsystem
|
import de.staropensource.engine.base.implementable.Subsystem
|
||||||
import de.staropensource.engine.base.logging.Logger
|
import de.staropensource.engine.base.logging.Logger
|
||||||
|
import de.staropensource.engine.base.type.logging.ChannelSettings
|
||||||
import de.staropensource.engine.base.utility.dnihbd.BuildInformation
|
import de.staropensource.engine.base.utility.dnihbd.BuildInformation
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -95,4 +96,18 @@ class AnsiSubsystem : Subsystem() {
|
||||||
override fun shutdown(final: Boolean, fatalCrash: Boolean) {
|
override fun shutdown(final: Boolean, fatalCrash: Boolean) {
|
||||||
info = null
|
info = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -----> Miscellaneous
|
||||||
|
/**
|
||||||
|
* Makes the [AnsiFormatter]
|
||||||
|
* the default log formatter.
|
||||||
|
*
|
||||||
|
* @return this instance
|
||||||
|
* @since v1-alpha10
|
||||||
|
*/
|
||||||
|
fun makeFormatterDefault(): AnsiSubsystem {
|
||||||
|
ChannelSettings.global = ChannelSettings.global.copy(formatter = AnsiFormatter.instance)
|
||||||
|
return this
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,7 @@ class Main private constructor() {
|
||||||
|
|
||||||
// Register subsystems
|
// Register subsystems
|
||||||
AnsiSubsystem.register()
|
AnsiSubsystem.register()
|
||||||
|
(Engine.getSubsystem(AnsiSubsystem::class) as AnsiSubsystem?)?.makeFormatterDefault()
|
||||||
|
|
||||||
// Initialize engine
|
// Initialize engine
|
||||||
Engine.initialize()
|
Engine.initialize()
|
||||||
|
|
Loading…
Reference in a new issue