7 comments.

  1. Tom

    You can place dots in next to the line numbers and then click on the little bug icon, like displayed on this image.

    This will open this debug screen:

    1. Elad Benda

      I meant google-ads-script not google-apps-script. Fixed the tags. Where do you run this from?

    2. Tom

      Ah, never worked with Google Ads script, but this might still work as they are also .gs files. I always run this by opening a Google Spreadsheet and going to Extra > Script Editor. But you can simply reach it at script.google.com.

    3. Rafa Guillermo

      Also remember to click the debug icon, not the run icon (the button that looks like a bug, not the play button)

  2. Neilord

    you can use this function.

    For example: MyLogger("test");

    function MyLogger(s,d=true,w=800,h=400,t=5) { const cs=CacheService.getScriptCache(); const cached=cs.get("Logger"); const ts=Utilities.formatDate(new Date(), SpreadsheetApp.getActive().getSpreadsheetTimeZone(), "MM|dd|HH:mm:ss") if(cached) { var v=Utilities.formatString('%s<br />[%s] - %s',cached,ts,s); }else{ var v=Utilities.formatString('[%s] - %s',ts,s); } cs.put("Logger",v,t); //allows logging without displaying. if(d) { const a='<br /><input type="button" value="Exit" onClick="google.script.host.close();" />'; const b='<br /><input type="button" value="Exit" onClick="google.script.host.close();" /><br />'; SpreadsheetApp.getUi().showModelessDialog(HtmlService.createHtmlOutput(b+v+a).setWidth(w).setHeight(h), 'My Logger'); } }

    (To view logs open spreadsheet with your script)

    1. Elad Benda

      not sure what's missing: added your method (see original post text).

    2. Elad Benda

      Cannot call SpreadsheetApp.getUi() from this context.

Add a new comment.