Debugging
When configured, the Salesforce Interaction SDK can output messages to the browser
console for debugging purposes. By default, the logger is configured with a log level of
none. The logger used by the Web SDK wraps the standard browser
console.log function and can be accessed at
SalesforceInteractions.log.
Logging Level
Logging levels can be set to control the amount of debug output.
| Level | Description |
|---|---|
| trace | Used for finer-grained informational messages than debug. Value: 5 |
| debug | Used for informational messages at a fine-grained level useful for debugging. Value: 4 |
| info | Used for informational messages at a course-grained level. Value: 3 |
| warn | Used for potential issues with the Web SDK that can affect functionality. Value: 2 |
| error | Used for error events that can indicate the Web SDK isn’t functioning properly. Value: 1 |
| none | Indicates disabling logging. Value: 0 |
The table orders the log levels from highest, trace, to lowest, none. A log level outputs any message at that same log level or lower.
Debugging Methods
1getLoggingLevel(): LoggingLevelReturns the numeric value of the current logging level used in the Web SDK.
1SalesforceInteractions.getLoggingLevel()
2// => 01setLoggingLevel(level?: LoggingLevel | keyof typeof LoggingLevel): voidSet the logging level used in the Web SDK.
1// using the logging level name
2 SalesforceInteractions.setLoggingLevel('error')
3
4// using the logging level value
5SalesforceInteractions.setLoggingLevel(1)1log.info(...args: any[]): voidPrints out a message at the info level.
1SalesforceInteractions.log.info("hello!")1log.debug(...args: any[]): voidPrints out a message at the debug level.
1SalesforceInteractions.log.debug("hello!")1log.error(...args: any[]): voidPrints out a message at the error level.
1SalesforceInteractions.log.error("hello!")1log.trace(...args: any[]): voidPrints out a message at the trace level.
1SalesforceInteractions.log.trace("hello!")1log.warn(...args: any[]): voidPrints out a message at the warn level.
1SalesforceInteractions.log.warn("hello!")