From fec0b6c713dd1604a4a3769856477c64f3ed8c9c Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Mon, 18 Jul 2016 07:13:15 -0700 Subject: [PATCH] Better logging. --- .../com/beust/kobalt/plugin/kotlin/KotlinCompiler.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinCompiler.kt b/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinCompiler.kt index 6d159d37..f3cc93f3 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinCompiler.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinCompiler.kt @@ -101,13 +101,16 @@ class KotlinCompiler @Inject constructor( throw UnsupportedOperationException("not implemented") } + fun CompilerMessageLocation.dump(s: String) = "$path:$line:$column $s" + override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation) { if (severity.isError) { - System.err.println(location.path + ":" + location.line + ":" + location.column - + " " + message) - } else { - println(severity.name + ": $message") + System.err.println(location.dump(message)) + } else if (severity == CompilerMessageSeverity.WARNING) { + warn(location.dump(message)) + } else if (severity == CompilerMessageSeverity.INFO && KobaltLogger.LOG_LEVEL >= 2) { + log(2, location.dump(message)) } } }