diff options
author | Paweł Marks <pmarks@virtuslab.com> | 2019-11-14 16:13:30 +0100 |
---|---|---|
committer | Błażej Kardyś <bkardys@virtuslab.com> | 2019-11-25 16:24:16 +0100 |
commit | e7c23a65606a5a844d1664552c935590a06bf58d (patch) | |
tree | f107c49acef882e4b21e8b93d1a43c2981d56458 /core | |
parent | dac6ba2a589aa1e8a9f4a9c7af32026be77776b3 (diff) | |
download | dokka-e7c23a65606a5a844d1664552c935590a06bf58d.tar.gz dokka-e7c23a65606a5a844d1664552c935590a06bf58d.tar.bz2 dokka-e7c23a65606a5a844d1664552c935590a06bf58d.zip |
Few fixes for logger
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/kotlin/DokkaBootstrapImpl.kt | 8 | ||||
-rw-r--r-- | core/src/main/kotlin/DokkaGenerator.kt | 4 | ||||
-rw-r--r-- | core/src/main/kotlin/Utilities/DokkaLogging.kt | 12 |
3 files changed, 18 insertions, 6 deletions
diff --git a/core/src/main/kotlin/DokkaBootstrapImpl.kt b/core/src/main/kotlin/DokkaBootstrapImpl.kt index b48b62d4..2e52d9c6 100644 --- a/core/src/main/kotlin/DokkaBootstrapImpl.kt +++ b/core/src/main/kotlin/DokkaBootstrapImpl.kt @@ -25,10 +25,18 @@ fun parsePerPackageOptions(arg: String): List<PackageOptions> { class DokkaBootstrapImpl : DokkaBootstrap { private class DokkaProxyLogger(val consumer: BiConsumer<String, String>) : DokkaLogger { + override fun debug(message: String) { + consumer.accept("debug", message) + } + override fun info(message: String) { consumer.accept("info", message) } + override fun progress(message: String) { + consumer.accept("progress", message) + } + override fun warn(message: String) { consumer.accept("warn", message) } diff --git a/core/src/main/kotlin/DokkaGenerator.kt b/core/src/main/kotlin/DokkaGenerator.kt index a522ea40..fb4bf98f 100644 --- a/core/src/main/kotlin/DokkaGenerator.kt +++ b/core/src/main/kotlin/DokkaGenerator.kt @@ -24,10 +24,10 @@ class DokkaGenerator( ) { fun generate(): Unit { - logger.info("Initializing plugins") + logger.debug("Initializing plugins") val context = DokkaContext.from(configuration.pluginsClasspath) context.pluginNames.also { names -> - logger.info("Loaded plugins: $names") + logger.progress("Loaded plugins: $names") names.groupingBy { it }.eachCount().filter { it.value > 1 }.forEach { logger.warn("Duplicate plugin name: ${it.key}. It will make debugging much harder.") } diff --git a/core/src/main/kotlin/Utilities/DokkaLogging.kt b/core/src/main/kotlin/Utilities/DokkaLogging.kt index 1ef52837..d0d1bff6 100644 --- a/core/src/main/kotlin/Utilities/DokkaLogging.kt +++ b/core/src/main/kotlin/Utilities/DokkaLogging.kt @@ -1,7 +1,9 @@ package org.jetbrains.dokka interface DokkaLogger { + fun debug(message: String) fun info(message: String) + fun progress(message: String) fun warn(message: String) fun error(message: String) } @@ -9,11 +11,13 @@ interface DokkaLogger { object DokkaConsoleLogger : DokkaLogger { var warningCount: Int = 0 + override fun debug(message: String)= println(message) + + override fun progress(message: String) = println("PROGRESS: $message") + override fun info(message: String) = println(message) - override fun warn(message: String) { - println("WARN: $message") - warningCount++ - } + + override fun warn(message: String) = println("WARN: $message").also { warningCount++ } override fun error(message: String) = println("ERROR: $message") |