Debug with log entries
If something goes wrong in the hook, log entries can help you debug it.
Use console.log() and console.error() to add log and error entries, respectively.
Here is a hook example with logging:
This is the output of the test run: