Handle long strings in debug

This commit is contained in:
Nick O'Leary
2016-10-25 21:40:33 +01:00
parent 2b558768f1
commit 1c905da8c2
2 changed files with 13 additions and 2 deletions

View File

@@ -108,6 +108,11 @@ module.exports = function(RED) {
if (seen.indexOf(value) !== -1) { return "[circular]"; }
seen.push(value);
}
if (typeof value === 'string') {
if (value.length > debuglength) {
return value.substring(0,debuglength)+"...";
}
}
return value;
}," ");
} else {
@@ -129,7 +134,9 @@ module.exports = function(RED) {
msg.msg = "(undefined)";
} else {
msg.format = "string ["+msg.msg.length+"]";
msg.msg = msg.msg;
if (msg.msg.length > debuglength) {
msg.msg = msg.msg.substring(0,debuglength)+"...";
}
}
// if (msg.msg.length > debuglength) {