mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Avoid corrupting message payload while logging.
This commit is contained in:
parent
b1f14031a9
commit
96ea81894d
@ -41,8 +41,7 @@ module.exports = function(RED) {
|
|||||||
} else { // debug just the msg.payload
|
} else { // debug just the msg.payload
|
||||||
if (this.console == "true") {
|
if (this.console == "true") {
|
||||||
if (typeof msg.payload === "string") {
|
if (typeof msg.payload === "string") {
|
||||||
if (msg.payload.indexOf("\n") != -1) { msg.payload = "\n"+msg.payload; }
|
node.log((msg.payload.indexOf("\n") != -1 ? "\n" : "") + msg.payload);
|
||||||
node.log(msg.payload);
|
|
||||||
}
|
}
|
||||||
else if (typeof msg.payload === "object") { node.log("\n"+util.inspect(msg.payload, {colors:useColors, depth:10})); }
|
else if (typeof msg.payload === "object") { node.log("\n"+util.inspect(msg.payload, {colors:useColors, depth:10})); }
|
||||||
else { node.log(util.inspect(msg.payload, {colors:useColors})); }
|
else { node.log(util.inspect(msg.payload, {colors:useColors})); }
|
||||||
|
Loading…
Reference in New Issue
Block a user