Logging and Debugging

Logging is an important SDK feature that lets you control the verbosity of the SDK's output. By default, logging is disabled. You must enable it by defining a log level and output destination using the setLogger method for iOS or setLogging method for Android on the SFMCSdk instance. Once enabled, the SDK uses the native unified logging system to capture log output.

Log LevelDescription
ErrorDetails unrecoverable errors that prevent key functionalities from working.
WarnHighlights potential problems or unexpected situations. These are typically recoverable issues that won't stop the SDK from functioning but should be addressed.
DebugProvides detailed, low-level information about the SDK's internal operations. Use this level for in-depth troubleshooting and diagnostics.

Here's how you can enable and use logging in your application.

The state property of the SDK returns operational information containing current configuration settings, session details, event queue size, and consent state. This information is critical for debugging and troubleshooting purposes.

Always inspect the SDK state during debugging to verify your configuration and understand the SDK's current status.

Here's an example of the SDK state output: