Debug with log entries
When developing hooks, you can use log entries to debug issues and track your hook's execution. Cloudhooks supports standard Node.js logging methods for debugging purposes.
You can use two main logging methods:
- console.log() for general debugging information
- console.error() for error messages and warnings
Here is a hook example with logging:
This is the output of the test run:
Best practices:
- Use descriptive log messages that help identify where the issue occurred
- Include relevant variables or error information in your logs
- Use console.error() for actual errors and console.log() for informational messages
- Consider adding timestamps or sequence indicators in complex workflows
- Remove or comment out debug logs before deploying to production