Node.debug in function node code

The documentation on writing code for function nodes says that node.debug can be used for logging. However whenever I try to use it I get unhandled exceptions saying that node is undefined. What am I missing here? console.log works fine. It would nice to have the time stamps provided by node.debug though? Please don't tell me how to add timestamps to console.log. That is not the question I am asking :slight_smile:

node.debug("Hello") works for me in a function node. Although in settings.js my debugging level is set to the default of "info", so it is basically ignored. Using node.warn("Hello") shows up in the log and the debug tab in the editor. The same settings file shows the hierarchy of log messages as below. Since "warn" is above the setting of "info", it will be included, but "debug" is below, so it will not. Either way, I don't get an error. Can you show your actual code?

            // Level of logging to be recorded. Options are:
            // fatal - only those errors which make the application unusable should be recorded
            // error - record errors which are deemed fatal for a particular request + fatal errors
            // warn - record problems which are non fatal + errors + fatal errors
            // info - record information about the general running of the application + warn + error + fatal erro$
            // debug - record information which is more verbose than info + info + warn + error + fatal errors
            // trace - record very detailed logging + debug + info + warn + error + fatal errors
            // off - turn off all logging (doesn't affect metrics or audit)

If you are using 1.1.0, then node.debug will only work in the main Function code - you can't use it in the setup/close tabs. This is something we'll be addressing in 1.2.0.

If that isn't the case here, can you share your code so we can see how you're using it?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.