mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-11-17 13:53:49 +00:00
improve start launcher plugin logs
This commit is contained in:
parent
9e4bb9d678
commit
28a804d988
@ -39,14 +39,18 @@ object StartLauncherPlugin : StartPlugin {
|
|||||||
|
|
||||||
includes(
|
includes(
|
||||||
config.plugins.mapNotNull {
|
config.plugins.mapNotNull {
|
||||||
|
val pluginName = it::class.simpleName ?: it.toString()
|
||||||
runCatching {
|
runCatching {
|
||||||
|
logger.i { "Start koin module registration for $pluginName" }
|
||||||
module {
|
module {
|
||||||
with(it) {
|
with(it) {
|
||||||
setupDI(rawJsonObject)
|
setupDI(rawJsonObject)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.onFailure { e ->
|
}.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()
|
}.getOrNull()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -76,16 +80,17 @@ object StartLauncherPlugin : StartPlugin {
|
|||||||
logger.i("Start starting of subplugins")
|
logger.i("Start starting of subplugins")
|
||||||
val scope = koin.get<CoroutineScope>()
|
val scope = koin.get<CoroutineScope>()
|
||||||
koin.get<Config>().plugins.map { plugin ->
|
koin.get<Config>().plugins.map { plugin ->
|
||||||
|
val pluginName = plugin::class.simpleName ?: plugin.toString()
|
||||||
scope.launch {
|
scope.launch {
|
||||||
runCatchingSafely {
|
runCatchingSafely {
|
||||||
logger.i("Start loading of $plugin")
|
logger.i("Start loading of $pluginName")
|
||||||
with(plugin) {
|
with(plugin) {
|
||||||
startPlugin(koin)
|
startPlugin(koin)
|
||||||
}
|
}
|
||||||
}.onFailure { e ->
|
}.onFailure { e ->
|
||||||
logger.w("Unable to start plugin $plugin", e)
|
logger.w("Unable to start plugin $pluginName", e)
|
||||||
}.onSuccess {
|
}.onSuccess {
|
||||||
logger.i("Complete loading of $plugin")
|
logger.i("Complete loading of $pluginName")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.joinAll()
|
}.joinAll()
|
||||||
|
Loading…
Reference in New Issue
Block a user