Type:
- object
Properties:
Name | Type | Description |
---|---|---|
LOG_LEVEL.OFF |
number | Logging is off. Value is 0. |
LOG_LEVEL.ERROR |
number | Error logging level. Value is 1. |
LOG_LEVEL.WARN |
number | Warning logging level. Value is 2. |
LOG_LEVEL.INFO |
number | Information logging level. Value is 4. |
LOG_LEVEL.APP_TRACE |
number | Application tracing logging level. Value is 6. |
LOG_LEVEL.ENGINE_TRACE |
number | Engine tracing logging level. Value is 9. |
Log an error message. The error function always writes the error, regardless of the log level from the server or set with apex.debug.setLevel. Messages are written using the browsers built-in console logging, if available. If supported, console.trace is called. Older browsers may not support the console object or all of its features.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
arguments |
* |
<repeatable> |
Any number of parameters which will be logged to the console. |
Examples
This example writes the message "Update Failed" to the console.
apex.debug.error( "Update Failed" );
This example writes an exception message (from variable
ex
) to the console.
apex.debug.error( "Exception: ", ex );
Method that returns the debug log level.
The debug log level is synchronized with hidden input element #pdebug
.
In a developer session, the default log level is WARN.
Returns:
- Type
- number
Example
This example retrieves the logging level, prepends "Level=" and logs to the console.
apex.debug.log( "Level=", apex.debug.getLevel() );
Log an informational message. Similar to apex.debug.message with the level set to INFO.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
arguments |
* |
<repeatable> |
Any number of parameters which will be logged to the console. |
Example
This example prints an informational message to the console if the log level is INFO or greater.
apex.debug.info( "Command successful" );
Log a message. Similar to apex.debug.message with the level set to the highest level.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
arguments |
* |
<repeatable> |
Any number of parameters which will be logged to the console. |
Example
This example gets the logging level and writes it to the console, regardless of the current logging level.
apex.debug.log( "Level=", apex.debug.getLevel() );
Log a message at the given debug log level. The log level set from the server or with apex.debug.setLevel controls if the message is actually written. If the set log level is >= pLevel then the message is written. Messages are written using the browsers built-in console logging, if available. Older browsers may not support the console object or all of its features.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pLevel |
number | A number from 1 to 9, where level 1 is most important, and level 9 is least important. Can be one of the apex.debug.LOG_LEVEL constants. Any other value such as 0 will turn off debug logging. | |
arguments |
* |
<repeatable> |
Any number of parameters which will be logged to the console. |
Example
This example writes the message "Testing" to the console if the logging level is greater than or equal to 7.
apex.debug.message( 7, "Testing" );
Method that sets the debug log level. Log messages at or below the specified level are written to the
console log. It is rarely necessary to call this function because the debug log level is
synchronized with the hidden input element #pdebug
that comes from the server.
Parameters:
Name | Type | Description |
---|---|---|
pLevel |
number | A number from 1 to 9, where level 1 is most important, and level 9 is least important. Can be one of the LOG_LEVEL constants. Any other value such as 0 will turn off debug logging. |
Example
This example sets the logging level to application tracing.
apex.debug.setLevel( apex.debug.LOG_LEVEL.APP_TRACE) );
Log a trace message. Similar to apex.debug.message with the level set to APP_TRACE.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
arguments |
* |
<repeatable> |
Any number of parameters which will be logged to the console. |
Example
This example writes a log message to the console if the debug log level is APP_TRACE or greater.
apex.debug.trace( "Got click event: ", event );
Log a warning message. Similar to apex.debug.message with the level set to WARN.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
arguments |
* |
<repeatable> |
Any number of parameters which will be logged to the console. |
Example
This example writes a warning message to the console if the debug log level is WARN or greater.
apex.debug.warn( "Empty string ignored" );