Console
Write to the script console, in the style of a web browser's console, and measure how long things take. log, info, warn and error print a line; time and timeEnd time a piece of the script; count counts how many times a line runs.
Where to find it: type console. in a JavaScript script, or open the ARCx API view of the script editor and expand console
Commands
| Command | What it does |
|---|---|
| console.count | Adds one to the unnamed counter and prints its new value to the script output, starting at 1. |
| console.error | Stops the script with an error that has no message. |
| console.info | Prints an empty line to the script output. |
| console.log | Prints an empty line to the script output. |
| console.logToARC | Writes a line to the ARCx debug log, as an information entry, rather than to the script console. |
| console.time | Starts the unnamed timer. |
| console.timeEnd | Stops the unnamed timer and prints how long it ran, as hours:minutes:seconds, to the script output. |
| console.warn | Prints an empty line to the script output. |
Details
console.count
Adds one to the unnamed counter and prints its new value to the script output, starting at 1.
console.count()
console.count(key)
| Value | Type | What it is |
|---|---|---|
key |
string | Optional. The name of the counter. |
console.error
Stops the script with an error that has no message. Unlike a web browser's console, this does not just print.
console.error()
console.error(txt)
| Value | Type | What it is |
|---|---|---|
txt |
string | Optional. The error message. |
console.info
Prints an empty line to the script output.
console.info()
console.info(txt)
| Value | Type | What it is |
|---|---|---|
txt |
string | Optional. The text to print. |
console.log
Prints an empty line to the script output.
console.log()
console.log(txt)
| Value | Type | What it is |
|---|---|---|
txt |
string | Optional. The text to print. |
console.logToARC
Writes a line to the ARCx debug log, as an information entry, rather than to the script console.
console.logToARC(txt)
| Value | Type | What it is |
|---|---|---|
txt |
string | The text to log. |
console.time
Starts the unnamed timer. Fails with an error if it is already running.
console.time()
console.time(key)
| Value | Type | What it is |
|---|---|---|
key |
string | Optional. The name of the timer. |
console.timeEnd
Stops the unnamed timer and prints how long it ran, as hours:minutes:seconds, to the script output. Fails with an error if it was not started.
console.timeEnd()
console.timeEnd(key)
| Value | Type | What it is |
|---|---|---|
key |
string | Optional. The name of the timer. |
console.warn
Prints an empty line to the script output.
console.warn()
console.warn(txt)
| Value | Type | What it is |
|---|---|---|
txt |
string | Optional. The text to print. |