如何使用用户交互记录应用程序脚本? [英] how to log apps-script with user interaction?

查看:102
本文介绍了如何使用用户交互记录应用程序脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I would like to log an apps-script that is meant to be run as a service, and requires user-interaction. The log journal (in google script editor) logs indeed the "doGet start" entry but not the "handler" one... as clicking on the "execute" button in the google editor does not show the UiApp.

我发现有效地看到用户界面的唯一方法是发布脚本并执行它的公共URL ......但我不知道在哪里查找日志。

The only way I found to effectively see the Ui is to publish the script and execute its public url... but then I don't know where to find the logs.

欢迎提供任何提示,谢谢。

Any hint is welcome, thanks.

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;
}


推荐答案

问题811 要求持久记录器功能。请为它加上星号来添加你的投票。在没有此功能的情况下,您可以将日志写入电子表格单元或您可以看到的Google云端硬盘中的文档。您可以使用Logger.getLog()函数来获取记录器的整个文本

There is an open issue - Issue 811 which asks for a persistent logger function. Please star it to add your vote. In the absence of this feature, you can write the logs to a Spreadsheet cell or a document in your Google Drive which you can see . You can use the Logger.getLog() function to get the entire text of your logger thus far

这篇关于如何使用用户交互记录应用程序脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆