diff --git a/packages/node_modules/@node-red/nodes/core/common/21-debug.js b/packages/node_modules/@node-red/nodes/core/common/21-debug.js index 07d75378e..8de1a1307 100644 --- a/packages/node_modules/@node-red/nodes/core/common/21-debug.js +++ b/packages/node_modules/@node-red/nodes/core/common/21-debug.js @@ -2,7 +2,7 @@ module.exports = function(RED) { "use strict"; var util = require("util"); var events = require("events"); - var path = require("path"); + //var path = require("path"); var debuglength = RED.settings.debugMaxLength || 1000; var useColors = RED.settings.debugUseColors || false; util.inspect.styles.boolean = "red"; @@ -20,7 +20,6 @@ module.exports = function(RED) { this.statusVal = n.statusVal || this.complete; this.tosidebar = n.tosidebar; if (this.tosidebar === undefined) { this.tosidebar = true; } - this.severity = n.severity || 40; this.active = (n.active === null || typeof n.active === "undefined") || n.active; if (this.tostatus) { this.status({fill:"grey", shape:"ring"}); } else { this.status({}); } @@ -28,26 +27,6 @@ module.exports = function(RED) { var statExpression = hasStatExpression ? n.statusVal : null; var node = this; - var levels = { - off: 1, - fatal: 10, - error: 20, - warn: 30, - info: 40, - debug: 50, - trace: 60, - audit: 98, - metric: 99 - }; - var colors = { - "0": "grey", - "10": "grey", - "20": "red", - "30": "yellow", - "40": "grey", - "50": "green", - "60": "blue" - }; var preparedEditExpression = null; var preparedStatExpression = null; if (editExpression) { @@ -107,13 +86,19 @@ module.exports = function(RED) { this.on("input", function(msg, send, done) { if (node.tostatus === true) { - prepareStatus(msg,function(err,debugMsg) { + prepareStatus(msg, function(err,debugMsg) { if (err) { node.error(err); return; } var output = debugMsg.msg; var st = (typeof output === 'string') ? output : util.inspect(output); - var severity = msg.errorlevel || node.severity; if (st.length > 32) { st = st.substr(0,32) + "..."; } - node.status({fill:colors[severity] || "grey", shape:"dot", text:st}); + var fill = "grey"; + var shape = "dot"; + if (node.statusVal === "error.message" && msg.hasOwnProperty("error")) { fill = "red"; } + if (node.statusVal === "status.text" && msg.hasOwnProperty("status")) { + if (msg.status.hasOwnProperty("fill")) { fill = msg.status.fill; } + if (msg.status.hasOwnProperty("shape")) { shape = msg.status.shape; } + } + node.status({fill:fill, shape:shape, text:st}); }); }