Logging in scripts is very helpful when debugging. For Cloud scripts, anything printed to stdout using println, or using a logger.info('message') call will be available in the Script Logs page. You'll find these in the Execution History of Script Listeners and Workflow Functions too. The usage of assertions can also help when debugging and diagnosing the behavior of scripts.