diff options
Diffstat (limited to 'javadoc/src')
-rw-r--r-- | javadoc/src/main/kotlin/dokka-adapters.kt | 2 | ||||
-rw-r--r-- | javadoc/src/main/kotlin/reporter.kt | 18 |
2 files changed, 12 insertions, 8 deletions
diff --git a/javadoc/src/main/kotlin/dokka-adapters.kt b/javadoc/src/main/kotlin/dokka-adapters.kt index c9183d50..0f7c53d7 100644 --- a/javadoc/src/main/kotlin/dokka-adapters.kt +++ b/javadoc/src/main/kotlin/dokka-adapters.kt @@ -9,7 +9,7 @@ class JavadocGenerator(val conf: DokkaGenerator) : Generator { val module = nodes.single() as DocumentationModule DokkaConsoleLogger.report() - HtmlDoclet.start(ModuleNodeAdapter(module, StandardReporter, conf.outputDir)) + HtmlDoclet.start(ModuleNodeAdapter(module, StandardReporter(conf.logger), conf.outputDir)) } override fun buildOutlines(nodes: Iterable<DocumentationNode>) { diff --git a/javadoc/src/main/kotlin/reporter.kt b/javadoc/src/main/kotlin/reporter.kt index ce80ec7b..fc38368c 100644 --- a/javadoc/src/main/kotlin/reporter.kt +++ b/javadoc/src/main/kotlin/reporter.kt @@ -2,29 +2,33 @@ package org.jetbrains.dokka.javadoc import com.sun.javadoc.DocErrorReporter import com.sun.javadoc.SourcePosition +import org.jetbrains.dokka.DokkaLogger -object StandardReporter : DocErrorReporter { +class StandardReporter(val logger: DokkaLogger) : DocErrorReporter { override fun printWarning(msg: String?) { - System.err?.println("[WARN] $msg") + logger.warn(msg.toString()) } override fun printWarning(pos: SourcePosition?, msg: String?) { - System.err?.println("[WARN] ${pos?.file()}:${pos?.line()}:${pos?.column()}: $msg") + logger.warn(format(pos, msg)) } override fun printError(msg: String?) { - System.err?.println("[ERROR] $msg") + logger.error(msg.toString()) } override fun printError(pos: SourcePosition?, msg: String?) { - System.err?.println("[ERROR] ${pos?.file()}:${pos?.line()}:${pos?.column()}: $msg") + logger.error(format(pos, msg)) } override fun printNotice(msg: String?) { - System.err?.println("[NOTICE] $msg") + logger.info(msg.toString()) } override fun printNotice(pos: SourcePosition?, msg: String?) { - System.err?.println("[NOTICE] ${pos?.file()}:${pos?.line()}:${pos?.column()}: $msg") + logger.info(format(pos, msg)) } + + private fun format(pos: SourcePosition?, msg: String?) = + if (pos == null) msg.toString() else "${pos.file()}:${pos.line()}:${pos.column()}: $msg" }
\ No newline at end of file |