1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

Better error logging.

This commit is contained in:
Cedric Beust 2015-10-28 05:58:33 -07:00
parent b61388f04b
commit 4ca1af597e
2 changed files with 6 additions and 5 deletions

View file

@ -1,8 +1,6 @@
package com.beust.kobalt.internal
import com.beust.kobalt.misc.NamedThreadFactory
import com.beust.kobalt.misc.ToString
import com.beust.kobalt.misc.log
import com.beust.kobalt.misc.*
import com.google.common.collect.HashMultimap
import java.util.concurrent.*
@ -72,7 +70,7 @@ public class DynamicGraphExecutor<T>(val graph: DynamicGraph<T>,
} catch(ex: TimeoutException) {
log(2, "Time out")
} catch(ex: Exception) {
log(1, "Tests failed: ${ex.message}")
error("Error: ${ex.message}", ex)
gotError = true
}
}

View file

@ -47,9 +47,12 @@ class Logger(val dev: Boolean) {
final fun debug(tag: String, message: String) =
println(getPattern("D", "Debug ", tag, message))
final fun error(tag: String, message: String, e: Throwable? = null) =
final fun error(tag: String, message: String, e: Throwable? = null) {
println(getPattern("***** E", "***** ERROR ", tag, message) +
if (e != null) " Exception: " + e.message else "")
e?.printStackTrace()
}
final fun warn(tag: String, message: String, e: Throwable? = null) =
println(getPattern("W", "***** WARNING ", tag, message))