Add timestamp when command completes. Show stack trace for test framework errors.

This commit is contained in:
Mark Harrah 2009-11-10 18:51:18 -05:00
parent 1e30cb8203
commit 6c45fe1b2f
2 changed files with 10 additions and 2 deletions

View File

@ -398,7 +398,13 @@ class xMain extends xsbti.AppMain
val endTime = System.currentTimeMillis()
project.log.info("")
val ss = if(s.isEmpty) "" else s + " "
project.log.info("Total " + ss + "time: " + (endTime - startTime + 500) / 1000 + " s")
project.log.info("Total " + ss + "time: " + (endTime - startTime + 500) / 1000 + " s, completed " + nowString)
}
private def nowString =
{
import java.text.DateFormat
val format = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT)
format.format(new java.util.Date)
}
/** Provides a partial message describing why the given property is undefined. */
private def undefinedMessage(property: Project#UserProperty[_]): String =

View File

@ -60,6 +60,7 @@ object TestLogger
def warn(s: String) = log(Level.Warn, s)
def info(s: String) = log(Level.Info, s)
def debug(s: String) = log(Level.Debug, s)
def trace(t: Throwable) = logger.trace(t)
private def log(level: Level.Value, s: String) = logger.log(level, s)
def ansiCodesSupported() = logger.ansiCodesSupported
}
@ -72,8 +73,9 @@ class TestLogger(val log: TLogger) extends TestsListener
def testEvent(event: TestEvent): Unit = event.detail.foreach(count)
def endGroup(name: String, t: Throwable)
{
// log.trace(t) : need to add a trace method to org.scalatools.testing.Logger
try { log.getClass.getMethod("trace", classOf[Throwable]).invoke(log, t) } catch { case e: Exception => () }
log.error("Could not run test " + name + ": " + t.toString)
//log.trace(t)
}
def endGroup(name: String, result: Result.Value) {}
protected def count(event: TEvent): Unit =