Configuring logging

Medallia Experience Orchestration SDK for iOS 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 Interaction or Networking) to log levels (Verbose, Debug, etc).

Tip: We recommend the logging be enabled in the didFinishLaunchingWithOptions method of your project's AppDelegate class before the initialization of the SDK.

By default, Medallia Experience Orchestration 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 SDK log messages will be prefixed with [MedalliaMXO] 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 SDK.

MedalliaMXO.loggingConfiguration = MXOLoggingConfiguration { builder in
	builder.logLevel = .verbose
	builder.logComponent = .any
}
MedalliaMXO.loggingConfiguration = [MXOLoggingConfiguration initWithBuilder:^(MXOLoggingConfigurationBuilder * _Nonnull builder) {
	builder.logLevel = MXOLogLevelVerbose;
        builder.logComponent = MXOLogComponentAny;
}];

When setting MXOLogComponent 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 Medallia Experience Orchestration SDK.

MedalliaMXO.loggingConfiguration = MXOLoggingConfiguration { builder in
	builder.logLevel = [.error, .warn]
	builder.logComponent = [.networking, .interaction]
}
MedalliaMXO.loggingConfiguration = [MXOLoggingConfiguration initWithBuilder:^(MXOLoggingConfigurationBuilder * _Nonnull builder) {
	builder.logLevel = (MXOLogLevelError | MXOLogLevelWarn);
        builder.logComponent = (MXOLogComponentNetworking | MXOLogComponentInteraction);
}];

When setting multiple MXOLogLevel(s), the SDK will log only messages of those specific levels. Examples:

  • Setting Error and Warn will only log message of Error and Warn levels and nothing else.
  • Setting Verbose will log all messages.
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 Medallia Experience Orchestration logging off.

MedalliaMXO.loggingConfiguration = MXOLoggingConfiguration { builder in
	builder.logLevel = .none
	builder.logComponent = .none
}
MedalliaMXO.loggingConfiguration = [MXOLoggingConfiguration initWithBuilder:^(MXOLoggingConfigurationBuilder * _Nonnull builder) {
	builder.logLevel = MXOLogLevelNone;
        builder.logComponent = MXOLogComponentNone;
}];