aboutsummaryrefslogtreecommitdiff
path: root/javadoc/src/main/kotlin/reporter.kt
blob: fc38368c9e28ebfc6e0396f9ce3a73951a3f79a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package org.jetbrains.dokka.javadoc

import com.sun.javadoc.DocErrorReporter
import com.sun.javadoc.SourcePosition
import org.jetbrains.dokka.DokkaLogger

class StandardReporter(val logger: DokkaLogger) : DocErrorReporter {
    override fun printWarning(msg: String?) {
        logger.warn(msg.toString())
    }

    override fun printWarning(pos: SourcePosition?, msg: String?) {
        logger.warn(format(pos, msg))
    }

    override fun printError(msg: String?) {
        logger.error(msg.toString())
    }

    override fun printError(pos: SourcePosition?, msg: String?) {
        logger.error(format(pos, msg))
    }

    override fun printNotice(msg: String?) {
        logger.info(msg.toString())
    }

    override fun printNotice(pos: SourcePosition?, msg: String?) {
        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"
}