Skip to content

Logging Messages (console.log | console.warn | console.error)

To log messages the module console can be used to output messages. This is useful for debugging the scripts and monitoring their execution.

Depending on the script execution source, logs will be visible in: - Browser Console in browsers when executing Client scripts - The dedicated log screen within the application when executing Server scripts.

Placing logs in your code will allow you to get better insight in the execution of the script. Please note that it should not be used to print entire documents. Moreover, usage should be temporary to ensure the code remains readable and understandable.

Logs icon

Syntax

console.log(message1, message2, ..., messageN);
console.warn(message1, message2, ..., messageN); // client side available
console.error(message1, message2, ..., messageN); // client side available

Parameters

console functions can accept one or more arguments of any data type. These arguments are evaluated and concatenated into a string or displayed in a structured format in the log screen.

Function Parameter Type Required Client Server Description
log message1, ..., N Any Type No (not required but no use without) true true One or more values to output to the log screen.
warn message1, ..., N Any Type No (not required but no use without) true false One or more values to output to the log screen.
error message1, ..., N Any Type No (not required but no use without) true false One or more values to output to the log screen.

Return value

console does not return any value. It is used for its side effect of outputting information and finding problems inside scripts easier.

Example

The following examples show how to use console.log:

Outputting a simple string

console.log('Script started execution.');

Outputting the value of a variable

let userName = 'Alice';
console.log('Processing user:', userName);

Outputting an object

let userData = { id: 'user123', status: 'active' };
console.log('User data:', userData);