I'm trying to see output of a script, but when I go to "View Logs" I get an alert "No logs found. Use Logger API to add logs to your project."
How do I add the Logger API?
A basic approach to logging in Apps Script is to use the built-in Logger. Logs created this way can be viewed by selecting View > Logs in the script editor. These logs are intended for simple checks during development and debugging, and do not persist very long. * Logs Google Sheet information.
Shell Scripting: Expert Recipes for Linux, Bash, and More by logger is a command-line tool that uses the syslog facility present on most Unix and Linux systems. This has a few benefits, one of which is that it allows a non-privileged shell script to write to log files owned by the superuser.
Logger. Writes the string to the logging console. log(format, values) Logger. Writes a formatted string to the logging console, using the format and values provided.
Using TypeScript in a Clasp Project You can use clasp to quickly create a new local Apps Script project. This command creates an appsscript. json and Code.gs , the base of an Apps Script project. To use TypeScript in an App Script file, simply rename the file extension from gs to ts .
You will want to add into your code
Logger.log("Yes, this was logged");
Also reference this page for more info: https://developers.google.com/apps-script/reference/base/logger
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With