Let debug node show "topic" correctly for errors in functions.

This commit is contained in:
dceejay 2015-02-13 21:14:54 +00:00
parent ad6254c0b8
commit 5643c51507
1 changed files with 12 additions and 9 deletions

View File

@ -1,5 +1,5 @@
<!-- <!--
Copyright 2013 IBM Corp. Copyright 2013, 2015 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -192,13 +192,16 @@
payload = payload.substring(payload.indexOf(')')+1); payload = payload.substring(payload.indexOf(')')+1);
msg.className = 'debug-message'+(o.level?(' debug-message-level-'+o.level):''); msg.className = 'debug-message'+(o.level?(' debug-message-level-'+o.level):'');
msg.innerHTML = '<span class="debug-message-date">'+ msg.innerHTML = '<span class="debug-message-date">'+
getTimestamp()+'</span>'+ getTimestamp()+'</span><span class="debug-message-name">['+name+']'+
'<span class="debug-message-name">['+name+']</span>'+ '</span>';
'<span class="debug-message-topic">'+ // NOTE: relying on function error to have a "type" that all other msgs don't
(o.topic?topic+' : ':'')+ if (o.hasOwnProperty("type") && (o.type === "function")) {
(o.property?'[msg.'+property+']':'[msg]')+" : "+typ+ msg.innerHTML += '<span class="debug-message-topic">[function] : (error)</span>';
'</span>'+'<span class="debug-message-payload">'+ } else {
payload+'</span>'; msg.innerHTML += '<span class="debug-message-topic">'+(o.topic?topic+' : ':'')+
(o.property?'[msg.'+property+']':'[msg]')+" : "+typ+'</span>';
}
msg.innerHTML += '<span class="debug-message-payload">'+ payload+ '</span>';
var atBottom = (sbc.scrollHeight-messages.offsetHeight-sbc.scrollTop) < 5; var atBottom = (sbc.scrollHeight-messages.offsetHeight-sbc.scrollTop) < 5;
messageCount++; messageCount++;
$(messages).append(msg); $(messages).append(msg);
@ -263,7 +266,7 @@
display: block; display: block;
background: #fff; background: #fff;
padding: 1px 5px; padding: 1px 5px;
font-size: 9px; font-size: 10px;
color: #a66; color: #a66;
} }
.debug-message-name { .debug-message-name {