ZJS provides console API's which match Node.js' Console module. We describe them here as there could potentially be minor differences.
Note that the console API's do not support format specifiers (e.g. %d, %f etc.).
void assert(boolean value, optional string message);
Assert/throw an error if value
is false.
void error(optional string data);
Prints data
to stderr
with newline. (On Zephyr this will just print to stdout).
void warn(optional string data);
Alias for console.error()
void log(optional string data);
Prints data
to stdout
with newline.
void info(optional string data);
Alias for console.log()
.
void time(string label);
Starts a timer used to compute the duration of an operation. The label
string is used
to reference the timer when calling console.timeEnd()
.
void timeEnd(string label);
Stops a timer previously started with console.time()
and prints the resulting time
difference to stdout
.