Use the following functions in your Node-RED function node code for debugging:
node.log() -> message to console
node.warn() -> message to console & warning to debug panel
node.error() -> message to console & warning to debug panel
Example:
node.warn(["Debug message, print my variable", myVar]);