diff options
Diffstat (limited to 'javadoc/src/main/kotlin/reporter.kt')
-rw-r--r-- | javadoc/src/main/kotlin/reporter.kt | 18 |
1 files changed, 11 insertions, 7 deletions
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 |