From 28a804d98894a69ee2c904591e532735010b277c Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 22 Feb 2023 10:28:25 +0600 Subject: [PATCH] improve start launcher plugin logs --- .../src/commonMain/kotlin/StartLauncherPlugin.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/startup/launcher/src/commonMain/kotlin/StartLauncherPlugin.kt b/startup/launcher/src/commonMain/kotlin/StartLauncherPlugin.kt index 6d7289da2bd..e9e14facee2 100644 --- a/startup/launcher/src/commonMain/kotlin/StartLauncherPlugin.kt +++ b/startup/launcher/src/commonMain/kotlin/StartLauncherPlugin.kt @@ -39,14 +39,18 @@ object StartLauncherPlugin : StartPlugin { includes( config.plugins.mapNotNull { + val pluginName = it::class.simpleName ?: it.toString() runCatching { + logger.i { "Start koin module registration for $pluginName" } module { with(it) { setupDI(rawJsonObject) } } }.onFailure { e -> - logger.w("Unable to load DI part of $it", e) + logger.w("Unable to register koin module of $pluginName", e) + }.onSuccess { + logger.i("Successfully registered koin module of $pluginName") }.getOrNull() } ) @@ -76,16 +80,17 @@ object StartLauncherPlugin : StartPlugin { logger.i("Start starting of subplugins") val scope = koin.get() koin.get().plugins.map { plugin -> + val pluginName = plugin::class.simpleName ?: plugin.toString() scope.launch { runCatchingSafely { - logger.i("Start loading of $plugin") + logger.i("Start loading of $pluginName") with(plugin) { startPlugin(koin) } }.onFailure { e -> - logger.w("Unable to start plugin $plugin", e) + logger.w("Unable to start plugin $pluginName", e) }.onSuccess { - logger.i("Complete loading of $plugin") + logger.i("Complete loading of $pluginName") } } }.joinAll()