Logging

The Didomi SDK on iOS will log various informational and error messages.

As recommended by Apple, we use two mechanisms for logging:

Formats

iOS 9 - NSLog

Messages logged with NSLog use the format: Didomi - {LEVEL} - {Message}

Example: Didomi - ERROR - Didomi SDK is not ready

iOS 10+ - os_log

Messages logged with os_log use the type type to indicate the level and the following information:

  • Subsystem: Bundle.main.bundleIdentifier or io.didomi.sdk if the bundler identifier is not available

  • Category: Didomi

Example:

Levels

We use the standard log levels supported by os_log: debug, error, info, and fault.

You can decide what level of logs should be displayed by the SDK by calling the setLogLevel function:

import os
...
Didomi.shared.setLogLevel(minLevel: OSLogType.debug.rawValue)
Didomi.shared.setLogLevel(minLevel: 2)

If your app supports iOS 9, use the actual value of the error level instead of OSLogType:

Level

Value

info

1

debug

2

error

16

fault

17