Default Log

For writing log, a global function 'log()' is provided.

log("hello world");

It is also possible to pass the result of strings concatenation or arithmetic calculation as a parameter value, as shown below:

log(1 + 4);
log("hello " +"world!");

Printing out in a Specified Page Layout

Using a global function 'logf()', you can print out data by specified format or page layout. This function is similar with the traditional printf() function, and the difference is strings can also use the alignment feature.

logf("%2.2f\n", 31.249);
logf("%-10s%-10s", "Hello", "World");
logf("#%02X%02X%02X\n", 255, 128, 128);

Output result

31.25
Hello     World
#FF8080

For more detailed formats, please refer to the console API.

Saving the logs

'log()' and 'logf()' stands for 'console.log()' and 'console.logf()'. Using setLogFile() of console, you can connect output content of console to a file.