Merge pull request #1992 from twain47/loggerhelper-readability

Clean up log output from determine-basal.js
This commit is contained in:
Milos Kozak 2019-08-28 21:03:28 +02:00 committed by GitHub
commit 9d55ef9120
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 7 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,14 @@ 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(' ');
} }
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(' ');
} }