Here is a workaround to replace the default Google App logger which has some drawbacks from my point of view : First, it's restricted for logging only strings. You can't debug complex objects. Furthermore, it only accepts one argument by call, not very handy ...
The Logger.gs file from this gist contains a log() function that stacks the logged objects into the document cache and a popLogs() function to retrieve them. In template.html
file, the logs are retrieved from the server then pushed into the Javascript console every 500ms.
- 1 / Copy the Logger.gs file into your project
- 2 / Copy the JS from
template.html
in your main template
- Call log() function into your server code
- Use your browser console to retrieve your logged messages when your Google Add-on is running
Enjoy ! Feel free to comment and improve !