From 85a092b1cd3d0baf88e320db5b14bb1fc8a97e1c Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Sun, 13 Dec 2015 08:26:12 +0400 Subject: [PATCH] Color for error/warning. --- src/main/kotlin/com/beust/kobalt/AsciiArt.kt | 3 ++- src/main/kotlin/com/beust/kobalt/misc/KobaltLogger.kt | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/beust/kobalt/AsciiArt.kt b/src/main/kotlin/com/beust/kobalt/AsciiArt.kt index b37c549e..de16f9d7 100644 --- a/src/main/kotlin/com/beust/kobalt/AsciiArt.kt +++ b/src/main/kotlin/com/beust/kobalt/AsciiArt.kt @@ -90,7 +90,8 @@ class AsciiArt { private fun yellow(s: String) = wrap(s, YELLOW) fun taskColor(s: String) = s - fun errorColor(s: String) = s + fun errorColor(s: String) = red(s) + fun warnColor(s: String) = red(s) } } diff --git a/src/main/kotlin/com/beust/kobalt/misc/KobaltLogger.kt b/src/main/kotlin/com/beust/kobalt/misc/KobaltLogger.kt index 0796dd9f..a8d5a17f 100644 --- a/src/main/kotlin/com/beust/kobalt/misc/KobaltLogger.kt +++ b/src/main/kotlin/com/beust/kobalt/misc/KobaltLogger.kt @@ -75,7 +75,7 @@ class Logger(val dev: Boolean) { final fun warn(tag: String, message: String, e: Throwable? = null) { val fullMessage = "***** WARNING " + (e?.message ?: message) - println(getPattern("W", fullMessage, fullMessage, tag)) + println(AsciiArt.Companion.warnColor(getPattern("W", fullMessage, fullMessage, tag))) } final fun log(tag: String, message: String, newLine: Boolean) =