mirror of https://github.com/sbt/sbt.git
show full stack trace by default when running in batch mode
This commit is contained in:
parent
2df88bf0a3
commit
dc2aaaf7ac
|
|
@ -39,11 +39,13 @@ object LogManager
|
||||||
def getOr[T](key: AttributeKey[T], default: T): T = data.get(scope, key) getOrElse default
|
def getOr[T](key: AttributeKey[T], default: T): T = data.get(scope, key) getOrElse default
|
||||||
val screenLevel = getOr(logLevel.key, Level.Info)
|
val screenLevel = getOr(logLevel.key, Level.Info)
|
||||||
val backingLevel = getOr(persistLogLevel.key, Level.Debug)
|
val backingLevel = getOr(persistLogLevel.key, Level.Debug)
|
||||||
val screenTrace = getOr(traceLevel.key, -1)
|
val screenTrace = getOr(traceLevel.key, defaultTraceLevel(state))
|
||||||
val backingTrace = getOr(persistTraceLevel.key, Int.MaxValue)
|
val backingTrace = getOr(persistTraceLevel.key, Int.MaxValue)
|
||||||
val extraBacked = state.globalLogging.backed :: Nil
|
val extraBacked = state.globalLogging.backed :: Nil
|
||||||
multiLogger( new MultiLoggerConfig(console, backed, extraBacked ::: extra, screenLevel, backingLevel, screenTrace, backingTrace) )
|
multiLogger( new MultiLoggerConfig(console, backed, extraBacked ::: extra, screenLevel, backingLevel, screenTrace, backingTrace) )
|
||||||
}
|
}
|
||||||
|
def defaultTraceLevel(state: State): Int =
|
||||||
|
if(state.interactive) -1 else Int.MaxValue
|
||||||
def suppressedMessage(key: ScopedKey[_], state: State): SuppressedTraceContext => Option[String] =
|
def suppressedMessage(key: ScopedKey[_], state: State): SuppressedTraceContext => Option[String] =
|
||||||
{
|
{
|
||||||
lazy val display = Project.showContextKey(state)
|
lazy val display = Project.showContextKey(state)
|
||||||
|
|
|
||||||
|
|
@ -118,9 +118,9 @@ object BasicCommands
|
||||||
val line = reader.readLine(prompt)
|
val line = reader.readLine(prompt)
|
||||||
line match {
|
line match {
|
||||||
case Some(line) =>
|
case Some(line) =>
|
||||||
val newState = s.copy(onFailure = Some(Shell), remainingCommands = line +: Shell +: s.remainingCommands)
|
val newState = s.copy(onFailure = Some(Shell), remainingCommands = line +: Shell +: s.remainingCommands).setInteractive(true)
|
||||||
if(line.trim.isEmpty) newState else newState.clearGlobalLog
|
if(line.trim.isEmpty) newState else newState.clearGlobalLog
|
||||||
case None => s
|
case None => s.setInteractive(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,5 @@ object BasicKeys
|
||||||
val historyPath = AttributeKey[Option[File]]("history", "The location where command line history is persisted.", 40)
|
val historyPath = AttributeKey[Option[File]]("history", "The location where command line history is persisted.", 40)
|
||||||
val shellPrompt = AttributeKey[State => String]("shell-prompt", "The function that constructs the command prompt from the current build state.", 10000)
|
val shellPrompt = AttributeKey[State => String]("shell-prompt", "The function that constructs the command prompt from the current build state.", 10000)
|
||||||
val watch = AttributeKey[Watched]("watch", "Continuous execution configuration.", 1000)
|
val watch = AttributeKey[Watched]("watch", "Continuous execution configuration.", 1000)
|
||||||
|
private[sbt] val interactive = AttributeKey[Boolean]("interactive", "True if commands are currently being entered from an interactive environment.", 10)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,13 @@ trait Identity {
|
||||||
override final def toString = super.toString
|
override final def toString = super.toString
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** StateOps methods to be merged at the next binary incompatible release. */
|
||||||
|
private[sbt] trait NewStateOps
|
||||||
|
{
|
||||||
|
def interactive: Boolean
|
||||||
|
def setInteractive(flag: Boolean): State
|
||||||
|
}
|
||||||
|
|
||||||
/** Convenience methods for State transformations and operations. */
|
/** Convenience methods for State transformations and operations. */
|
||||||
trait StateOps {
|
trait StateOps {
|
||||||
def process(f: (String, State) => State): State
|
def process(f: (String, State) => State): State
|
||||||
|
|
@ -151,6 +158,11 @@ object State
|
||||||
new Reboot(app.scalaProvider.version, state.remainingCommands, app.id, state.configuration.baseDirectory)
|
new Reboot(app.scalaProvider.version, state.remainingCommands, app.id, state.configuration.baseDirectory)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private[sbt] implicit def newStateOps(s: State): NewStateOps = new NewStateOps {
|
||||||
|
def interactive = s.get(BasicKeys.interactive).getOrElse(false)
|
||||||
|
def setInteractive(i: Boolean) = s.put(BasicKeys.interactive, i)
|
||||||
|
}
|
||||||
|
|
||||||
/** Provides operations and transformations on State. */
|
/** Provides operations and transformations on State. */
|
||||||
implicit def stateOps(s: State): StateOps = new StateOps {
|
implicit def stateOps(s: State): StateOps = new StateOps {
|
||||||
def process(f: (String, State) => State): State =
|
def process(f: (String, State) => State): State =
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue