Check for empty interfaces before initializing them in the logger

Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
2025-04-29 13:05:03 +02:00
parent 6fb304a4a1
commit 599ade3981
@@ -333,12 +333,12 @@ class ArcaneLogger {
/// Initializes all registered [LoggingInterface]s by calling their /// Initializes all registered [LoggingInterface]s by calling their
/// [LoggingInterface.init] methods. /// [LoggingInterface.init] methods.
Future<ArcaneLogger> initializeInterfaces() async { Future<ArcaneLogger> initializeInterfaces() async {
if (!initialized) await _init();
if (I._interfaces.isEmptyOrNull) { if (I._interfaces.isEmptyOrNull) {
throw Exception("No logging interfaces have been registered."); throw Exception("No logging interfaces have been registered.");
} }
if (!initialized) await _init();
for (final LoggingInterface i in I._interfaces) { for (final LoggingInterface i in I._interfaces) {
if (!i.initialized) await i.init(); if (!i.initialized) await i.init();
} }