Skip to content

Commit

Permalink
keys cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
harrah committed Feb 27, 2011
1 parent c21c580 commit 0729798
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 4 additions & 0 deletions main/Keys.scala
Expand Up @@ -15,6 +15,10 @@ package sbt

object Keys
{
// logging
val LogLevel = SettingKey[Level.Value]("log-level")
val PersistLogLevel = SettingKey[Level.Value]("persist-log-level")

// Project keys
val ProjectCommand = AttributeKey[Boolean]("project-command")
val SessionKey = AttributeKey[SessionSettings]("session-settings")
Expand Down
8 changes: 3 additions & 5 deletions main/LogManager.scala
Expand Up @@ -7,15 +7,16 @@ package sbt
import LogManager._
import std.Transform
import Project.ScopedKey
import Keys.{LogLevel => ScreenLogLevel, PersistLogLevel}

object LogManager
{
def construct(data: Settings[Scope]) = (task: ScopedKey[_], to: PrintWriter) =>
{
val scope = task.scope
def level(key: AttributeKey[Level.Value], default: Level.Value): Level.Value = data.get(scope, key) getOrElse default
val screenLevel = level(ScreenLogLevel, Level.Info)
val backingLevel = level(PersistLogLevel, Level.Debug)
val screenLevel = level(ScreenLogLevel.key, Level.Info)
val backingLevel = level(PersistLogLevel.key, Level.Debug)

val console = ConsoleLogger()
val backed = ConsoleLogger(ConsoleLogger.printWriterOut(to), useColor = false) // TODO: wrap this with a filter that strips ANSI codes
Expand All @@ -28,7 +29,4 @@ object LogManager
backed setLevel backingLevel
multi: Logger
}

val ScreenLogLevel = AttributeKey[Level.Value]("screen-log-level")
val PersistLogLevel = AttributeKey[Level.Value]("persist-log-level")
}

0 comments on commit 0729798

Please sign in to comment.