blob: 9fe15d5967ea8987ba187dd795c9381cc9137f8b (
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
35
36
|
package org.jetbrains.dokka.utilities
interface DokkaLogger {
fun debug(message: String)
fun info(message: String)
fun progress(message: String)
fun warn(message: String)
fun error(message: String)
}
object DokkaConsoleLogger : DokkaLogger {
var warningCount: Int = 0
var errorCount: 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").also { warningCount++ }
override fun error(message: String) = println("ERROR: $message").also { errorCount++ }
fun report() {
if (warningCount > 0 || errorCount > 0) {
println("generation completed with $warningCount warning" +
(if(warningCount == 1) "" else "s") +
" and $errorCount error" +
if(errorCount == 1) "" else "s"
)
} else {
println("generation completed successfully")
}
}
}
|