Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
ofbiz-rhino
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
74582d6e
authored
2014-04-16 10:40:24 -0500
by
Adam Heath
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Improve the logging format a little bit.
1 parent
acfc8c96
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
src/com/brainfood/ofbiz/rhino/OfbizRhinoContainer.java
src/com/brainfood/ofbiz/rhino/OfbizRhinoContainer.java
View file @
74582d6
...
...
@@ -4,7 +4,9 @@ import java.io.File;
import
java.io.FileNotFoundException
;
import
java.io.FileReader
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
com.brainfood.rhino.Console
;
...
...
@@ -49,16 +51,28 @@ public class OfbizRhinoContainer extends RhinoContainer<OfbizRhinoContainer> {
return
"OfbizConsole"
;
}
private
static
void
addOneLogItem
(
StringBuilder
format
,
List
<
Object
>
logArgs
,
Object
logItem
)
{
if
(
logItem
==
null
)
{
format
.
append
(
"%s"
);
logArgs
.
add
(
null
);
}
else
{
logArgs
.
add
(
Context
.
toString
(
logItem
));
logArgs
.
add
(
logItem
.
getClass
().
getName
());
format
.
append
(
"%s<%s>"
);
}
}
public
void
log
(
Context
cx
,
Object
[]
args
,
Function
funObj
)
{
Object
[]
sargs
=
Console
.
getSArgs
(
args
);
StringBuilder
format
=
new
StringBuilder
();
List
<
Object
>
logArgs
=
new
ArrayList
(
args
.
length
*
2
+
1
);
format
.
append
(
':'
);
for
(
int
i
=
0
;
i
<
args
.
length
;
i
++)
{
if
(
i
!=
0
)
{
format
.
append
(
", "
);
}
format
.
append
(
"%s"
);
addOneLogItem
(
format
,
logArgs
,
args
[
i
]
);
}
Debug
.
logInfo
(
format
.
toString
(),
module
,
sargs
);
Debug
.
logInfo
(
format
.
toString
(),
module
,
logArgs
.
toArray
(
new
Object
[
logArgs
.
size
()])
);
}
}
...
...
Please
register
or
sign in
to post a comment