Clean up log output from determine-basal.js

This commit is contained in:
Brian Quinion 2019-08-25 21:23:47 +01:00
parent 5ca170e660
commit 157dc097d1
2 changed files with 27 additions and 6 deletions

View file

@ -1,12 +1,33 @@
var console = { }; var console = { };
console.error = function error(){ console.error = function error(){
var s = '';
for (var i = 0, len = arguments.length; i < len; i++) { for (var i = 0, len = arguments.length; i < len; i++) {
console2.log(arguments[i]); if (i > 0) s = s + ' ';
if (typeof arguments[i] === 'undefined') {
s = s + 'undefined';
} else if (typeof arguments[i] === 'object') {
s = s + JSON.stringify(arguments[i]);
} else {
s = s + arguments[i].toString();
}
} }
s = s + "\n";
console2.log(s);
}; };
console.log = function log(){ console.log = function log(){
var s = '';
for (var i = 0, len = arguments.length; i < len; i++) { for (var i = 0, len = arguments.length; i < len; i++) {
console2.log(arguments[i]); if (i > 0) s = s + ' ';
if (typeof arguments[i] === 'undefined') {
s = s + 'undefined';
} else if (typeof arguments[i] === 'object') {
s = s + JSON.stringify(arguments[i]);
} else {
s = s + arguments[i].toString();
}
//console2.log(arguments[i]);
} }
s = s + "\n";
console2.log(s);
}; };

View file

@ -36,16 +36,16 @@ public class LoggerCallback extends ScriptableObject {
public void jsFunction_log(Object obj1) { public void jsFunction_log(Object obj1) {
if (L.isEnabled(L.APS)) if (L.isEnabled(L.APS))
log.debug(obj1.toString()); log.debug(obj1.toString().trim());
logBuffer.append(obj1.toString()); logBuffer.append(obj1.toString());
logBuffer.append(' '); // logBuffer.append(' ');
} }
public void jsFunction_error(Object obj1) { public void jsFunction_error(Object obj1) {
if (L.isEnabled(L.APS)) if (L.isEnabled(L.APS))
log.error(obj1.toString()); log.error(obj1.toString().trim());
errorBuffer.append(obj1.toString()); errorBuffer.append(obj1.toString());
errorBuffer.append(' '); // errorBuffer.append(' ');
} }