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() subsystem.initialize()
} catch (throwable: Throwable) { } catch (throwable: Throwable) {
logger.crash( 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, throwable = throwable,
fatal = true fatal = true
) )
@ -280,11 +280,11 @@ class Engine private constructor() {
logger.verb("Reloading subsystems") logger.verb("Reloading subsystems")
for (subsystem: Subsystem in subsystems) for (subsystem: Subsystem in subsystems)
try { 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() subsystem.reload()
} catch (throwable: Throwable) { } catch (throwable: Throwable) {
logger.crash( 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, throwable = throwable,
fatal = true fatal = true
) )
@ -384,17 +384,20 @@ class Engine private constructor() {
// Initialize subsystems // Initialize subsystems
logger.verb("Shutting subsystems down") logger.verb("Shutting subsystems down")
for (subsystem: Subsystem in subsystems) for (subsystem: Subsystem in subsystems) {
val subsystemVersion: String = subsystem.getVersion()
try { 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) subsystem.shutdown(final = final, fatalCrash = crashed)
} catch (throwable: Throwable) { } catch (throwable: Throwable) {
logger.crash( 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, throwable = throwable,
fatal = true fatal = true
) )
} }
}
// Print shutdown message // Print shutdown message
if (final) if (final)

View file

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