Fixes the stacktrace trimming

Ref https://github.com/sbt/sbt/issues/4121
Ref https://github.com/sbt/sbt/pull/4232
This commit is contained in:
Eugene Yokota 2018-06-27 06:36:47 -04:00
parent b643c98f29
commit 434e294f28
3 changed files with 10 additions and 5 deletions

View File

@ -421,7 +421,7 @@ class ConsoleAppender private[ConsoleAppender] (
}
private def appendTraceEvent(te: TraceEvent): Unit = {
val traceLevel = getTrace
val traceLevel = if (getTrace < 0) Int.MaxValue else getTrace
val throwableShowLines: ShowLines[Throwable] =
ShowLines[Throwable]((t: Throwable) => {
List(StackTrace.trimmed(t, traceLevel))

View File

@ -13,15 +13,20 @@ object MainAppender {
def multiLogger(log: ManagedLogger, config: MainAppenderConfig): ManagedLogger = {
import config._
// TODO
// console setTrace screenTrace
// backed setTrace backingTrace
// multi: Logger
// val log = LogExchange.logger(loggerName)
LogExchange.unbindLoggerAppenders(log.name)
LogExchange.bindLoggerAppenders(
log.name,
(consoleOpt.toList map { _ -> screenLevel }) :::
(consoleOpt.toList map { appender =>
appender match {
case a: ConsoleAppender =>
a.setTrace(screenTrace)
case _ => ()
}
appender -> screenLevel
}) :::
List(backed -> backingLevel) :::
(extra map { x =>
(x -> Level.Info)

View File

@ -4,7 +4,7 @@
package sbt.internal.util
object StackTrace {
def isSbtClass(name: String) = name.startsWith("sbt") || name.startsWith("xsbt")
def isSbtClass(name: String) = name.startsWith("sbt.") || name.startsWith("xsbt.")
/**
* Return a printable representation of the stack trace associated