Configuring logging

Medallia Experience Orchestration Cordova SDK provides an extensible logging configuration API for debug or reporting purposes. The API can be configured to log any combination of Components (features or technical concepts such as Networking or Interaction) to log levels (Verbose, Debug, etc).

By default, the Medallia Experience Orchestration Cordova SDK for Android logs Error and Warn messages for Any component. Orchestration Cordova SDK for iOS does not display any debug log messages. However, exception messages are printed in the console, when these occur.
Note: All Medallia Experience Orchestration Cordova SDK log messages are prefixed with [MedalliaMXO] for iOS and MedalliaMXO: for Android in the console.

Turning all logs on

This is an example of configuring logging to Verbose log level for Any Components of the Medallia Experience Orchestration Cordova SDK.

const loggingConfig = {
        levels: ['VERBOSE'],
        components: ['ANY']
}
MedalliaMXO.setLoggingConfiguration(loggingConfig).then(() => {
	// do something after the logging configuration has been set
})
.catch((error) => {
	// do something with the error
	console.error(error)
})

When setting components to only Any, all components will be logged in conjunction with the log level.

Turning specific logs on

This is an example of configuring logging to combination of Error and Warn levels for just Networking and Interaction components of the Medallia Experience Orchestration Cordova SDK.

const loggingConfig = {
        levels: ['ERROR', 'WARN'],
        components: ['NETWORKING', 'INTERACTION']
}
MedalliaMXO.setLoggingConfiguration(loggingConfig).then(() => {
	// do something after the logging configuration has been set
})
.catch((error) => {
	// do something with the error
	console.error(error)
})

When setting a single level, the SDK will log any messages of that level and above. The order from the bottom is: Verbose, Debug, Error, Warn, Info, Assert.

Examples:

  • Setting Info will log only Info and Assert messages.
  • Setting Verbose will log all messages.

When setting multiple levels, the SDK will log only messages of those specific levels. As an example, setting Error and Warn will only log message of Error and Warn levels and nothing else.

Tip: Do not set multiple component(s) along side the Any component. Choose only the components required or just use Any.

Turning all logs off

This is an example of turning the Medallia Experience Orchestration Cordova SDK logging off.

const loggingConfig = {
        levels: ['NONE'],
        components: ['NONE']
}
MedalliaMXO.setLoggingConfiguration(loggingConfig).then(() => {
	// do something after the logging configuration has been set
})
.catch((error) => {
	// do something with the error
	console.error(error)
})