Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:harrah/xsbt

  • Loading branch information...
commit 8d2275cbe6c3fdbce286e2c0524f48250eb96ae0 2 parents 85bc7a3 + 7fa3a7d
@harrah authored
Showing with 11 additions and 12 deletions.
  1. +11 −12 sbt/src/main/scala/sbt/WebApp.scala
View
23 sbt/src/main/scala/sbt/WebApp.scala
@@ -121,6 +121,9 @@ private class JettyLoggerBase(delegate: Logger)
def info(msg: String, arg0: AnyRef, arg1: AnyRef) { delegate.info(format(msg, arg0, arg1)) }
def debug(msg: String, arg0: AnyRef, arg1: AnyRef) { delegate.debug(format(msg, arg0, arg1)) }
def warn(msg: String, arg0: AnyRef, arg1: AnyRef) { delegate.warn(format(msg, arg0, arg1)) }
+ def info(msg: String, args: Array[AnyRef]) { delegate.info(format(msg, args: _*)) }
+ def debug(msg: String, args: Array[AnyRef]) { delegate.debug(format(msg, args: _*)) }
+ def warn(msg: String, args: Array[AnyRef]) { delegate.warn(format(msg, args: _*)) }
def warn(msg: String, th: Throwable)
{
delegate.warn(msg)
@@ -131,19 +134,15 @@ private class JettyLoggerBase(delegate: Logger)
delegate.debug(msg)
delegate.trace(th)
}
- private def format(msg: String, arg0: AnyRef, arg1: AnyRef) =
+ private def format(msg: String, args: AnyRef*) =
{
def toString(arg: AnyRef) = if(arg == null) "" else arg.toString
- val pieces = msg.split("""\{\}""", 3)
- if(pieces.length == 1)
- pieces(0)
- else
- {
- val base = pieces(0) + toString(arg0) + pieces(1)
- if(pieces.length == 2)
- base
- else
- base + toString(arg1) + pieces(2)
- }
+ val pieces = msg.split("""\{\}""", args.length + 1).toList
+ val argStrs = args.map(toString).toList ::: List("")
+ pieces.zip(argStrs).foldLeft(new StringBuilder) { (sb, pair) =>
+ val (piece, argStr) = pair
+ if (piece.isEmpty) sb
+ else sb.append(piece).append(argStr)
+ }.toString
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.