Jun 24, 2021 05:08 AM
Scripting within an automation, I’ve tried a couple of ways but I can’t get the console log to output across multiple lines. As a work around I can use a table, but it’s kind of annoying that it’s collapsed, and I just want a few lines of console to appear;
Any suggestions?
Solved! Go to Solution.
Sep 27, 2021 03:04 PM
Well aren’t Airtable devs just the best? Look what they’ve snuck in recently!!!
What a bunch of stars! Thank you!
Jun 24, 2021 06:54 AM
Can you give an example of what you want to see and why? If you are outputting a string, you can include \n
in the string.
Console.log is typically used for debugging purposes and isn’t designed to produce pretty output. Once the automation is setup, there’s no-one looking at the output anyway (unless someone goes digging in the run history).
Jun 24, 2021 03:16 PM
Thanks for looking into this @kuovonne
Example output would be;
CONSOLE.LOG
String of text data
Another string of text data
And another string of text data
I tried inserting \n into my output but it’s ignored. :frowning:
console.log('hello' ,`\n`, 'world');
I’m also trying to time stamp console log entries too, but needing a hand with formatting Date() into minutes/seconds - would appreciate if anyone can touch on this too.
Jun 24, 2021 08:27 PM
It looks like conosle.log
works differently from output.inspect
, so newline characters will not create line breaks with console.log
.
As for including a time stamp in a console.log entry, I find the easiest way to be
console.log(new Date().toISOString())
It isn’t pretty, but it gets the information out there.
Is there a particular reason why you need pretty output with console.log?
Jun 26, 2021 04:11 PM
I’m learning Javascript, and with other languages that I’ve learned I typically use debugging messages as I code as this assists with my learning. I found it odd that I couldn’t use new-line code within the Airtable console.log, as I think that new-line is almost standard with anything that parses a string. Obviously I can make multiple calls with console.log, but it takes up a lot of space, and doesn’t allow me to copy/paste easily.
Sep 27, 2021 03:04 PM
Well aren’t Airtable devs just the best? Look what they’ve snuck in recently!!!
What a bunch of stars! Thank you!