如何通过用户交互记录应用程序脚本?

Ber*_*teh 1 logging google-apps-script

我想记录一个应用程序脚本,该脚本旨在作为服务运行,并且需要用户交互。日志日志(在谷歌脚本编辑器中)确实记录了“doGet start”条目,而不是“处理程序”条目......因为点击谷歌编辑器中的“执行”按钮不会显示 UiApp。

我发现有效查看 Ui 的唯一方法是发布脚本并执行其公共 url ......但是我不知道在哪里可以找到日志。

欢迎任何提示,谢谢。

function doGet() {
  Logger.log("doGet start");
  var app = UiApp.createApplication().setTitle(" ");
  var handler = app.createServerHandler('selectionHandler');
  var docsUI = app.createDocsListDialog().addSelectionHandler(handler).showDocsPicker();
  return app;
}

function selectionHandler(e){
  var app = UiApp.getActiveApplication();
  Logger.log("handler");
  Logger.log(e.parameter);
  return app;
}
Run Code Online (Sandbox Code Playgroud)

meg*_*024 5

为了调试我的 Web 部署应用程序,我编写了一个库,它向应用程序添加了一个日志窗口并允许将消息输出到这个窗口。图书馆的项目密钥是MHDTOOt9dn-ViHNtwfsIfJ5lu8m0d5vP9. 有一个演示展示了这些能力。源代码也可用

我希望它可以帮助您解决 Logger 服务问题。