问题描述
我编写了一个网络应用程序脚本,该应用程序脚本被部署为在用户访问网络应用程序的情况下运行。
是否可以以编程方式导出网络应用程序脚本的执行副本?
不直接。
你不会得到一个完整的堆栈跟踪,但你可以用Logging记录你想要通知的所有内容。在脚本结尾处,您可以提取日志并发送邮件。
如果你真的想成为,自定义Logger的一些实现扩展了标准Logger.log()。例如,如果每次向它发送日志消息时都有一个对象,它会将整个持续时间,自上次日志以来的时间和传递给它的消息都标记为Logger.log。同样的对象可以有一个自己的getLog(0方法,它做了额外的东西 - 如果你愿意的话)。
但是总之,不能,你不能导出执行日志。 I have a written a web Apps Script which is deployed to run in the context of user accessing the web app. Is it possible to export web Apps Script's Execution Transcript programatically? Not directly. You won't get a full stack trace, but you can be meticulous with Logging everything you want to be notified with. At the end of the script you could extract the log and email that. If you really wanted to be fancy, there are a few implementations of custom Loggers which extent the standard Logger.log(). For instance if you had an object that every time you send a log message to it, it would time-stamp overall duration, time since last log and the message passed to it, all to Logger.log. Same object could have a getLog(0 method of its own which did extra stuff - should you wish. There is a notable logger library at Google Apps Script Examples by Peter Herrmann which will also allow you to log to a spreadsheet. But in short, no, you cannot export the execution log. 这篇关于是否可以导出Google Apps脚本执行记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!