aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Vogt <oss.nsp@cvogt.org>2016-11-03 03:30:51 +0000
committerChristopher Vogt <oss.nsp@cvogt.org>2016-11-03 16:32:04 -0400
commitd09063685d6ce790ad9f83e469f4179aeafea96a (patch)
treea55f12060066cbe6973a2e0bfd572181db6887c9
parentb980679a17ffb1f414730ce10786ba29aaa22e31 (diff)
downloadcbt-d09063685d6ce790ad9f83e469f4179aeafea96a.tar.gz
cbt-d09063685d6ce790ad9f83e469f4179aeafea96a.tar.bz2
cbt-d09063685d6ce790ad9f83e469f4179aeafea96a.zip
allow blacklisting loggers
-rw-r--r--stage1/logger.scala11
1 files changed, 10 insertions, 1 deletions
diff --git a/stage1/logger.scala b/stage1/logger.scala
index 0b352a1..57f0cfa 100644
--- a/stage1/logger.scala
+++ b/stage1/logger.scala
@@ -8,12 +8,21 @@ package cbt
* We can replace this with something more sophisticated eventually.
*/
case class Logger(enabledLoggers: Set[String], start: Long) {
- def this(enabledLoggers: Option[String], start: Long) = this( enabledLoggers.toVector.flatMap( _.split(",") ).toSet, start )
+ def this(enabledLoggers: Option[String], start: Long) = {
+ this(
+ enabledLoggers.toVector.flatMap( _.split(",") ).toSet,
+ start
+ )
+ }
+
+ val disabledLoggers: Set[String] = enabledLoggers.filter(_.startsWith("-")).map(_.drop(1))
def log(name: String, msg: => String) = {
if(
+ (
(enabledLoggers contains name)
|| (enabledLoggers contains "all")
+ ) && !(disabledLoggers contains name)
){
logUnguarded(name, msg)
}