【问题标题】:Google Cloud Stackdriver Debugging debug inside a for loop at a specific condition?Google Cloud Stackdriver Debugging 在特定条件下的 for 循环中调试?
【发布时间】:2018-05-26 13:08:14
【问题描述】:

我正在为两个Compute Engine/App Engine 应用程序使用 Google Cloud Stackdriver Debugging,我正在尝试在 for 循环中编写一个条件,以便当 for 循环针对某个条件执行时,我想查看该数据。

我的 App 引擎代码

for (var i = 0; i < docs.length; i++) {
         if (docs[i].country == "India") {
             var city = docs[i].city;
             var lang = docs[i].lang;
         } else {

         }
    }
}

现在对于上面的代码,我想看到lang的值,当国家的值是India,城市的值是Bangalore

现在我可以在var lang = docs[i].lang; 添加快照,但我只想为城市Bangalore 添加断点。

我试着写Condition

docs[i].city == "班加罗尔"

错误评估条件:TypeError: Cannot read property 'city' of undefined

谁能告诉我该怎么做。

【问题讨论】:

    标签: google-app-engine debugging google-cloud-platform stackdriver


    【解决方案1】:

    使用临时汽车“城市”

    city == "班加罗尔"

    要查看“lang”,请将快照放在“else”所在的下一行。

    【讨论】:

    • 对不起,我没听懂,你能给我看一下代码吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-01
    • 2018-01-24
    相关资源
    最近更新 更多