Skip to content
This repository was archived by the owner on Mar 14, 2019. It is now read-only.

Commit cc3167d

Browse files
author
sanxiao.xw
committed
separate parameter by using '\n'
1 parent 38edce0 commit cc3167d

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/main/scala/com/github/zhongl/housemd/command/Trace.scala

+5-2
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,16 @@ class DetailWriter(writer: BufferedWriter) {
158158
val thread = "[" + context.thread.getName + "]"
159159
val thisObject = if (context.thisObject == null) "null" else context.thisObject.toString
160160
val method = context.className + "." + context.methodName
161-
val arguments = context.arguments.mkString("[", " ", "]")
161+
val arguments = context.arguments.mkString("[" + ObjUtils.parameterSeparator, ObjUtils.parameterSeparator, "]")
162162
val resultOrExcption = context.resultOrException match {
163163
case Some(x) => ObjUtils.toString(x)
164164
case None if context.isVoidReturn => "void"
165165
case None => "null"
166166
}
167-
val line = (started :: elapse :: thread :: thisObject :: method :: arguments :: resultOrExcption :: Nil)
167+
168+
val argumentsAndResult = "Arguments: " + arguments + ObjUtils.parameterSeparator + "Result: " + resultOrExcption
169+
170+
val line = (started :: elapse :: thread :: thisObject :: method :: argumentsAndResult :: Nil)
168171
.mkString(" ")
169172
writer.write(line)
170173
writer.newLine()

src/main/scala/com/github/zhongl/housemd/misc/ObjUtils.scala

+4
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,20 @@ import com.cedarsoftware.util.io.JsonWriter
77
*/
88
object ObjUtils {
99
val jsonFormater = (ref: AnyRef) => JsonWriter.objectToJson(ref)
10+
1011
val toStringFormater = (ref: AnyRef) => Option(ref).getOrElse("null").toString
1112

1213
var formatter = toStringFormater
14+
var parameterSeparator: String = " "
1315

1416
def useJsonFormat() = {
1517
formatter = jsonFormater
18+
parameterSeparator = "\n"
1619
}
1720

1821
def useToStringFormat() = {
1922
formatter = toStringFormater
23+
parameterSeparator = " "
2024
}
2125

2226
def toString(obj: AnyRef) = {

0 commit comments

Comments
 (0)