iOS SDK Logging

ENGAGE® iOS SDK Logging

If ENGAGE SDK Version 4 and above are used, there is an option to control the verbosity of ENGAGE logs.

The options are presented in the new public enum EngageLogVerbosity:

public enum EngageLogVerbosity: Int {
    /// Allow no logs
    case none = 0
    
    /// Allow only error/fault logs (default behavior)
    case criticalOnly = 1
    
    /// Allow error/fault and high level event logs
    case minimal = 2
    
    /// Allow all logs
    case verbose = 3
}

By default, the ENGAGE SDK is in the criticalOnly logging mode.

There are two ways to control logging:

Option 1. Source Code

Before calling anything on Engage.shared, in both the main app and the Notification Service Extension, set the static logVerbosity read/write property on ENGAGE:

Engage.logVerbosity = .criticalOnly

Option 2. Xcode scheme environment argument

To control ENGAGE logs in the Xcode debugger without altering the source code, a launch argument may be used.

📘

NOTE:

This will override whichever value is set in Swift source code, but only in Xcode debug builds. For production, please use the Swift API.

A single key value pair is needed to accomplish this.

Key: "com.firstorion.engage-debugLogging"

Value:

Add this value to the table at:

Edit Scheme → Run -> Arguments → Environment Variables

The following example will set ENGAGE to only fire critical logs:

1856

What’s Next