🔊 Increase detail of logging
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 3 Nov 2019 00:14:18 +0000 (01:14 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 3 Nov 2019 00:14:18 +0000 (01:14 +0100)
src/main/kotlin/net/pterodactylus/sone/freenet/wot/IdentityLoader.kt

index fe5be5c..f9019d0 100644 (file)
@@ -38,17 +38,20 @@ class IdentityLoader @Inject constructor(private val webOfTrustConnector: WebOfT
 
        @Throws(PluginException::class)
        private fun loadTrustedIdentitiesForOwnIdentities(ownIdentities: Collection<OwnIdentity>) =
 
        @Throws(PluginException::class)
        private fun loadTrustedIdentitiesForOwnIdentities(ownIdentities: Collection<OwnIdentity>) =
-                       ownIdentities.associateWith { ownIdentity ->
-                               logger.fine { "Getting trusted identities for ${ownIdentities.size} own identities..."}
-                               if (ownIdentity.doesNotHaveCorrectContext()) {
-                                       logger.fine { "Skipping $ownIdentity because of incorrect context."}
-                                       emptySet()
-                               } else {
-                                       time({ stopwatch, identities -> "Loaded ${identities.size} identities for ${ownIdentity.nickname} in ${stopwatch.elapsed(MILLISECONDS) / 1000.0}s." }) {
-                                               webOfTrustConnector.loadTrustedIdentities(ownIdentity, context?.context)
+                       ownIdentities
+                                       .also { logger.fine { "Getting trusted identities for ${it.size} own identities..." } }
+                                       .associateWith { ownIdentity ->
+                                               logger.fine { "Getting trusted identities for $ownIdentity..." }
+                                               if (ownIdentity.doesNotHaveCorrectContext()) {
+                                                       logger.fine { "Skipping $ownIdentity because of incorrect context." }
+                                                       emptySet()
+                                               } else {
+                                                       logger.fine { "Loading trusted identities for $ownIdentity from WoT..." }
+                                                       time({ stopwatch, identities -> "Loaded ${identities.size} identities for ${ownIdentity.nickname} in ${stopwatch.elapsed(MILLISECONDS) / 1000.0}s." }) {
+                                                               webOfTrustConnector.loadTrustedIdentities(ownIdentity, context?.context)
+                                                       }
+                                               }
                                        }
                                        }
-                               }
-                       }
 
        private fun OwnIdentity.doesNotHaveCorrectContext() =
                        context?.let { it.context !in contexts } ?: false
 
        private fun OwnIdentity.doesNotHaveCorrectContext() =
                        context?.let { it.context !in contexts } ?: false