Help

New Line in console.log?

Topic Labels: Automations
Solved
Jump to Solution
1236 5
cancel
Showing results for 
Search instead for 
Did you mean: 

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;

image

Any suggestions?

image

1 Solution

Accepted Solutions

Well aren’t Airtable devs just the best? Look what they’ve snuck in recently!!!

image

What a bunch of stars! Thank you!

See Solution in Thread

5 Replies 5

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).

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.

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?

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.

Labels