Add AnsiSubsystem.makeFormattingDefault
All checks were successful
PRs & Pushes / test (push) Successful in 2m7s
PRs & Pushes / build-jars (push) Successful in 2m45s
PRs & Pushes / build-apidoc (push) Successful in 2m53s

This commit is contained in:
JeremyStar™ 2024-12-27 23:51:17 +01:00
parent 246e83c27d
commit ee23d7739d
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
2 changed files with 16 additions and 0 deletions

View file

@ -22,6 +22,7 @@ package de.staropensource.engine.ansi
import de.staropensource.engine.base.Engine
import de.staropensource.engine.base.implementable.Subsystem
import de.staropensource.engine.base.logging.Logger
import de.staropensource.engine.base.type.logging.ChannelSettings
import de.staropensource.engine.base.utility.dnihbd.BuildInformation
/**
@ -95,4 +96,18 @@ class AnsiSubsystem : Subsystem() {
override fun shutdown(final: Boolean, fatalCrash: Boolean) {
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
}
}

View file

@ -57,6 +57,7 @@ class Main private constructor() {
// Register subsystems
AnsiSubsystem.register()
(Engine.getSubsystem(AnsiSubsystem::class) as AnsiSubsystem?)?.makeFormatterDefault()
// Initialize engine
Engine.initialize()