aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Marks <pmarks@virtuslab.com>2019-11-14 16:13:30 +0100
committerBłażej Kardyś <bkardys@virtuslab.com>2019-11-25 16:24:16 +0100
commite7c23a65606a5a844d1664552c935590a06bf58d (patch)
treef107c49acef882e4b21e8b93d1a43c2981d56458
parentdac6ba2a589aa1e8a9f4a9c7af32026be77776b3 (diff)
downloaddokka-e7c23a65606a5a844d1664552c935590a06bf58d.tar.gz
dokka-e7c23a65606a5a844d1664552c935590a06bf58d.tar.bz2
dokka-e7c23a65606a5a844d1664552c935590a06bf58d.zip
Few fixes for logger
-rw-r--r--core/src/main/kotlin/DokkaBootstrapImpl.kt8
-rw-r--r--core/src/main/kotlin/DokkaGenerator.kt4
-rw-r--r--core/src/main/kotlin/Utilities/DokkaLogging.kt12
-rw-r--r--runners/ant/src/main/kotlin/ant/dokka.kt4
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt2
5 files changed, 23 insertions, 7 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")
diff --git a/runners/ant/src/main/kotlin/ant/dokka.kt b/runners/ant/src/main/kotlin/ant/dokka.kt
index 038bfca9..4bde902a 100644
--- a/runners/ant/src/main/kotlin/ant/dokka.kt
+++ b/runners/ant/src/main/kotlin/ant/dokka.kt
@@ -10,7 +10,9 @@ import org.jetbrains.dokka.DokkaConfiguration.ExternalDocumentationLink
import java.io.File
class AntLogger(val task: Task): DokkaLogger {
- override fun info(message: String) = task.log(message, Project.MSG_INFO)
+ override fun debug(message: String) = task.log(message, Project.MSG_DEBUG)
+ override fun info(message: String) = task.log(message, Project.MSG_VERBOSE)
+ override fun progress(message: String) = task.log(message, Project.MSG_INFO)
override fun warn(message: String) = task.log(message, Project.MSG_WARN)
override fun error(message: String) = task.log(message, Project.MSG_ERR)
}
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
index b668158d..940c496e 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
@@ -171,7 +171,9 @@ open class DokkaTask : DefaultTask() {
bootstrapProxy.configure(
BiConsumer { level, message ->
when (level) {
+ "debug" -> logger.debug(message)
"info" -> logger.info(message)
+ "progress" -> logger.lifecycle(message)
"warn" -> logger.warn(message)
"error" -> logger.error(message)
}