mirror of https://github.com/sbt/sbt.git
Merge pull request #211 from eed3si9n/wip/stacktrace
reimplement stacktrace suppression
This commit is contained in:
commit
f48340f708
|
|
@ -481,16 +481,23 @@ class ConsoleAppender private[ConsoleAppender] (
|
||||||
}
|
}
|
||||||
|
|
||||||
private def appendTraceEvent(te: TraceEvent): Unit = {
|
private def appendTraceEvent(te: TraceEvent): Unit = {
|
||||||
val traceLevel = if (getTrace < 0) Int.MaxValue else getTrace
|
val traceLevel = getTrace
|
||||||
val throwableShowLines: ShowLines[Throwable] =
|
if (traceLevel >= 0) {
|
||||||
ShowLines[Throwable]((t: Throwable) => {
|
val throwableShowLines: ShowLines[Throwable] =
|
||||||
List(StackTrace.trimmed(t, traceLevel))
|
ShowLines[Throwable]((t: Throwable) => {
|
||||||
})
|
List(StackTrace.trimmed(t, traceLevel))
|
||||||
val codec: ShowLines[TraceEvent] =
|
})
|
||||||
ShowLines[TraceEvent]((t: TraceEvent) => {
|
val codec: ShowLines[TraceEvent] =
|
||||||
throwableShowLines.showLines(t.message)
|
ShowLines[TraceEvent]((t: TraceEvent) => {
|
||||||
})
|
throwableShowLines.showLines(t.message)
|
||||||
codec.showLines(te).toVector foreach { appendLog(Level.Error, _) }
|
})
|
||||||
|
codec.showLines(te).toVector foreach { appendLog(Level.Error, _) }
|
||||||
|
}
|
||||||
|
if (traceLevel <= 2) {
|
||||||
|
suppressedMessage(new SuppressedTraceContext(traceLevel, ansiCodesSupported && useFormat)) foreach {
|
||||||
|
appendLog(Level.Error, _)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private def appendProgressEvent(pe: ProgressEvent): Unit =
|
private def appendProgressEvent(pe: ProgressEvent): Unit =
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,9 @@ object StackTrace {
|
||||||
* - If d is greater than 0, then up to that many lines are included,
|
* - If d is greater than 0, then up to that many lines are included,
|
||||||
* where the line for the Throwable is counted plus one line for each stack element.
|
* where the line for the Throwable is counted plus one line for each stack element.
|
||||||
* Less lines will be included if there are not enough stack elements.
|
* Less lines will be included if there are not enough stack elements.
|
||||||
|
*
|
||||||
|
* See also ConsoleAppender where d <= 2 is treated specially by
|
||||||
|
* printing a prepared statement.
|
||||||
*/
|
*/
|
||||||
def trimmedLines(t: Throwable, d: Int): List[String] = {
|
def trimmedLines(t: Throwable, d: Int): List[String] = {
|
||||||
require(d >= 0)
|
require(d >= 0)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue