--
http://nodered.org
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
http://nodered.org
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
As Dave mentioned, improving debugging and error handling is a focus area right now. For example, the new error handler node describe on the issue list: https://github.com/node-red/node-red/issues/560
Rather than do things piecemeal, we want to have a coherent overall plan in place.
We dont send .info to debug as it could overwhelm the useful things that have been explicitly wired to debug. We have an issue open around making the Debug sidebar more capable - https://github.com/node-red/node-red/issues/545 This could well include options to access the log output. The exact mechanism by which that would get enabled will depend on the wider design of the debug tab.
Enabling log/warn/debug from the function node has always been on the todo list and is in the plan for this release. Not had a chance to look at your PR but will do later and see how it fits with what we had in mind, along with the new error handler node and the requirements it brings.
Dan - all of this work will feed into better documentation around how you debug things in Node-RED.
Nick
[{"id":"2f9ab2c7.d0654e","type":"inject","name":"Debug = TRUE","topic":"TRUE","payload":"TRUE","payloadType":"string","repeat":"","crontab":"","once":false,"x":134,"y":133,"z":"59e2a191.a61d6","wires":[["bc4f4995.43b0b8"]]},{"id":"bc4f4995.43b0b8","type":"function","name":"set context.global.mydebug TRUE or FALSE","func":"context.global.mydebug = msg.payload;\nreturn msg;","outputs":1,"x":405,"y":117,"z":"59e2a191.a61d6","wires":[["d6e3be11.291c4"]]},{"id":"780d77e5.87f288","type":"inject","name":"Check debug","topic":"","payload":"","payloadType":"none","repeat":"","crontab":"","once":false,"x":128,"y":173,"z":"59e2a191.a61d6","wires":[["4f825917.b07da8"]]},{"id":"4f825917.b07da8","type":"function","name":"Check debug status","func":"msg.payload = context.global.mydebug;\nreturn msg;","outputs":1,"x":329,"y":173,"z":"59e2a191.a61d6","wires":[["d6e3be11.291c4"]]},{"id":"d6e3be11.291c4","type":"debug","name":"debugstatus","active":true,"console":"false","complete":"payload","x":684.0000190734863,"y":172.66667366027832,"z":"59e2a191.a61d6","wires":[]},{"id":"7d69b73a.829648","type":"inject","name":"Debug = FALSE","topic":"FALSE","payload":"FALSE","payloadType":"string","repeat":"","crontab":"","once":false,"x":137,"y":98,"z":"59e2a191.a61d6","wires":[["bc4f4995.43b0b8"]]},{"id":"d7767382.28899","type":"tail","name":"Get logfile","split":true,"filename":"/var/log/node-red.log","x":127.8823471069336,"y":259.2941198348999,"z":"59e2a191.a61d6","wires":[["124afd8e.edb502"]]},{"id":"124afd8e.edb502","type":"debug","name":"Redirected node-red.log","active":true,"console":"false","complete":"payload","x":350.9999885559082,"y":259.52941513061523,"z":"59e2a191.a61d6","wires":[]},{"id":"53132066.acece","type":"comment","name":"Set or check mydebug flag","info":"","x":147,"y":56,"z":"59e2a191.a61d6","wires":[]},{"id":"e93238de.16cdc8","type":"comment","name":"tail the console log","info":"Node-Red is strated like this:\n\nnode red.js -v > /var/log/node-red.log 2&>1\n","x":119.41177368164062,"y":224.23528957366943,"z":"59e2a191.a61d6","wires":[]},{"id":"f6564555.09a9b8","type":"function","name":"Just testing","func":"//Just for testing console.log() workaround\n\n// msg.payload = context.global.mydebug;\n// return msg;\n\nfunction mydebug(debugtext) {\n\tdebugflag = context.global.mydebug;\n\tif (debugflag == \"TRUE\") {\n\t console.log(debugtext+\"\\n\"); \n\t} else {\n//\t return [ msg, null ];\n\t}\n\n}\n\nmydebug(\"Debugging is TRUE\"); \n\nswitch (msg.topic) {\n case \"One\":\n msg.payload = \"Got input One\";\n mydebug(msg.payload); \n msg = null;\n break;\n case \"Two\":\n msg.payload = \"Got input Two\";\n mydebug(msg.payload); \n msg = null;\n break;\n \n default:\n \tmydebug(\"Apparently I got an Invalid Topic\"); \n msg = null;\n \tbreak;\n\n} \nreturn msg;","outputs":1,"x":436.42016983032227,"y":476.0924549102783,"z":"59e2a191.a61d6","wires":[["5ebfcfd4.a1403"]]},{"id":"9d1b5ff1.62e4a","type":"inject","name":"","topic":"One","payload":"1","payloadType":"string","repeat":"","crontab":"","once":false,"x":120.42015838623047,"y":438.52100563049316,"z":"59e2a191.a61d6","wires":[["f6564555.09a9b8"]]},{"id":"275f10f5.d8a0f","type":"inject","name":"","topic":"Two","payload":"2","payloadType":"string","repeat":"","crontab":"","once":false,"x":120.13443756103516,"y":479.23530292510986,"z":"59e2a191.a61d6","wires":[["f6564555.09a9b8"]]},{"id":"100bfa9c.eff405","type":"comment","name":"Just a test case","info":"Testing mydebug flag.\nI am just interested in the console.log() stuff","x":117.14286041259766,"y":401.4285955429077,"z":"59e2a191.a61d6","wires":[]},{"id":"f18f938c.0e707","type":"inject","name":"","topic":"Invalid Topic","payload":"99","payloadType":"string","repeat":"","crontab":"","once":false,"x":143.5714340209961,"y":515.7142944335938,"z":"59e2a191.a61d6","wires":[["f6564555.09a9b8"]]},{"id":"5ebfcfd4.a1403","type":"debug","name":"","active":true,"console":"false","complete":"false","x":597.4999999999999,"y":476.1666666666666,"z":"59e2a191.a61d6","wires":[]}]