diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2016-04-03 23:49:20 -0400 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2016-04-04 00:19:38 -0400 |
commit | f7b84e735e150578324caa0c4289404a033cd9b2 (patch) | |
tree | 55b26ec13c46c13d9a68fe00e1a73b7ed8b42c23 /stage1/logger.scala | |
parent | 8ed9a0a1c0c0b7175ed4693d9b6949f866802c4c (diff) | |
download | cbt-f7b84e735e150578324caa0c4289404a033cd9b2.tar.gz cbt-f7b84e735e150578324caa0c4289404a033cd9b2.tar.bz2 cbt-f7b84e735e150578324caa0c4289404a033cd9b2.zip |
Finally get rid of JDK 8 dependencies
Diffstat (limited to 'stage1/logger.scala')
-rw-r--r-- | stage1/logger.scala | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/stage1/logger.scala b/stage1/logger.scala index e513443..91a2412 100644 --- a/stage1/logger.scala +++ b/stage1/logger.scala @@ -1,7 +1,5 @@ package cbt -import java.time._ - /** * This represents a logger with namespaces that can be enabled or disabled as needed. The * namespaces are defined using {{enabledLoggers}}. Possible values are defined in the subobject @@ -9,13 +7,11 @@ import java.time._ * * We can replace this with something more sophisticated eventually. */ -case class Logger(enabledLoggers: Set[String]) { - def this(enabledLoggers: Option[String]) = this( enabledLoggers.toVector.flatMap( _.split(",") ).toSet ) - - val start = LocalTime.now() +case class Logger(enabledLoggers: Set[String], start: Long) { + def this(enabledLoggers: Option[String], start: Long) = this( enabledLoggers.toVector.flatMap( _.split(",") ).toSet, start ) def log(name: String, msg: => String) = { - val timeTaken = (Duration.between(start, LocalTime.now()).toMillis.toDouble / 1000).toString + val timeTaken = ((start - System.currentTimeMillis) / 1000).toString System.err.println( s"[${" "*(6-timeTaken.size)}$timeTaken][$name] $msg" ) } |