执行日志
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
无论是在预览模式还是在实际执行中,Google Ads 脚本都会显示两种类型的执行日志:更改日志和日志输出。
- 更改日志
更改日志会显示该脚本对 Google Ads 实体执行的所有更改:实体说明、更改类型、更改前后的值,以及错误(如果有):
您也可以进一步过滤更改日志,使其只显示错误。
- 日志输出
如果您在脚本中执行 console.log("Hello world!");
,日志中会显示“Hello world!”。记录少量文本在调试期间特别有用,但在实时执行期间通常也很有用。假设您安排每天运行下列脚本:
let spreadsheet = SpreadsheetApp.create("Daily Report");
// Populate the spreadsheet.
// ...
console.log("Daily report ready!");
console.log(spreadsheet.getUrl());
每次执行时,该脚本都会记录新创建的电子表格的网址,方便您日后查找。您还可以使用 console.warn()
或 console.error()
在日志中记录橙色或红色文本。
除了编程人员指定的日志消息之外,Google Ads 脚本在执行期间遇到的错误和警告也会显示在文字日志中。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-02-23。
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"没有我需要的信息"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"太复杂/步骤太多"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"内容需要更新"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻译问题"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"示例/代码问题"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"易于理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"解决了我的问题"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]