1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

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) {

View File

@ -120,7 +120,11 @@ RED.debug = (function() {
$('<span class="debug-message-object-value debug-message-type-meta">object</span>').appendTo(headerHead);
}
} else if (typeof value === 'string') {
$('<span class="debug-message-object-value debug-message-type-string"></span>').text('"'+value+'"').appendTo(headerHead);
var subvalue = value;
if (subvalue.length > 20) {
subvalue = subvalue.substring(0,50)+"...";
}
$('<span class="debug-message-object-value debug-message-type-string"></span>').text('"'+subvalue+'"').appendTo(headerHead);
} else {
$('<span class="debug-message-object-value debug-message-type-other"></span>').text(""+value).appendTo(headerHead);
}