r/nodered • • Dec 28 '22

debug node

Hello,

Until now I have used the debug node to check the msg output from the nodes while developing some flows. I used also frogger node to save on a log files already working flows, so I can check if they work as intended. My flows started to become more and more complex and bigger and to generate a lot of messages..so it started to become difficult to trace all the messages and I need to filter only these one that have problems. I found in frogger to have the option to set the log level to error,warn,info,debug and trace. I am not sure to understand every single difference between them, but I was supposing if I chose error, it will write to the log only the messages that generates errors in the flow.

I tried all the log levels, but I cannot see any differences. In the log file, it writes all the messages coming from the node on which I put the frogger node.

So my question is, if there are some alternatives to frogger which permit me to save only the messages when an error occurs or If I need to make some special setting to frogger so it will work in the way I suppose to work?.

0 Upvotes

1 comment sorted by

3

u/bwyer Dec 28 '22

You're misunderstanding the purpose of the flogger node. You're supposed to put it in a specific area of your code to output just one message that's useful to you. Not the entire buffer. The log level you set will be noted in the log file and is just for your information.

The intent is that you could have dozens or hundreds of flogger nodes. Some would put out informational, some warnings, some debug, etc. All of those would be dumped into one or more logfiles.

Think about how a typical Linux program works. It calls the syslog service to send messages to the system log files. As part of that call, it specifies the "log level" of the message.

To do what you want to do, you'd need to put the specific information you want to log into a specific message buffer (let's say msg.debug). You would then use a flogger node to write that to your log file.

Here is the documentation for flogger: https://flows.nodered.org/node/node-red-contrib-flogger