Add subsystem version to log messages
All checks were successful
PRs & Pushes / build (push) Successful in 2m51s
PRs & Pushes / test (push) Successful in 3m22s
PRs & Pushes / build-apidoc (push) Successful in 3m38s

This commit is contained in:
JeremyStar™ 2024-12-20 21:46:20 +01:00
parent 91128541f9
commit 048ae6b074
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
2 changed files with 11 additions and 8 deletions

View file

@ -226,7 +226,7 @@ class Engine private constructor() {
subsystem.initialize()
} catch (throwable: Throwable) {
logger.crash(
"Failed to initialize subsystem '${subsystem.getName()}' [${subsystem::class.qualifiedName ?: "<anonymous>"}]",
"Failed to initialize subsystem '${subsystem.getName()}'@'${subsystem.getVersion()}' [${subsystem::class.qualifiedName ?: "<anonymous>"}]",
throwable = throwable,
fatal = true
)
@ -280,11 +280,11 @@ class Engine private constructor() {
logger.verb("Reloading subsystems")
for (subsystem: Subsystem in subsystems)
try {
logger.diag("Reloading subsystem '${subsystem.getName()}' [${subsystem::class.qualifiedName ?: "<anonymous>"}]")
logger.diag("Reloading subsystem '${subsystem.getName()}'@'${subsystem.getVersion()}' [${subsystem::class.qualifiedName ?: "<anonymous>"}]")
subsystem.reload()
} catch (throwable: Throwable) {
logger.crash(
"Failed to reload subsystem '${subsystem.getName()}' [${subsystem::class.qualifiedName ?: "<anonymous>"}]",
"Failed to reload subsystem '${subsystem.getName()}'@'${subsystem.getVersion()}' [${subsystem::class.qualifiedName ?: "<anonymous>"}]",
throwable = throwable,
fatal = true
)
@ -384,17 +384,20 @@ class Engine private constructor() {
// Initialize subsystems
logger.verb("Shutting subsystems down")
for (subsystem: Subsystem in subsystems)
for (subsystem: Subsystem in subsystems) {
val subsystemVersion: String = subsystem.getVersion()
try {
logger.diag("Shutting subsystem '${subsystem.getName()}' [${subsystem::class.qualifiedName ?: "<anonymous>"}] down")
logger.diag("Shutting subsystem '${subsystem.getName()}'@'${subsystemVersion}' [${subsystem::class.qualifiedName ?: "<anonymous>"}] down")
subsystem.shutdown(final = final, fatalCrash = crashed)
} catch (throwable: Throwable) {
logger.crash(
"Failed to shutdown subsystem '${subsystem.getName()}' [${subsystem::class.qualifiedName ?: "<anonymous>"}]",
"Failed to shutdown subsystem '${subsystem.getName()}'@'${subsystemVersion}' [${subsystem::class.qualifiedName ?: "<anonymous>"}]",
throwable = throwable,
fatal = true
)
}
}
// Print shutdown message
if (final)

View file

@ -36,8 +36,8 @@ abstract class Subsystem {
/**
* Returns the version of this subsystem.
*
* Not called by the engine
* before [bootstrap].
* Only called by the engine between
* [initialize] and [shutdown].
*
* @return version
* @since v1-alpha10