Debug mode allows you to view debug logs for the Pilgrim SDK so you can quickly spot any configuration errors and better understand SDK states.

iOS Feature Overview

In the PilgrimManager, there is a method named presentDebugViewController(parentViewController:) that will present a view controller from your current view controller with the debug logs you can display in your host app.

For more detailed implementation instructions, follow these steps:

1. Configure Pilgrim

You should have already configured Pilgrim in your application’s AppDelegate (if not, see this).

2. Enable Debugging in AppDelegate

In the didFinishLaunchingWithOptions method where you configured the Pilgrim Manager, add the following line of code:

    PilgrimManager.shared().isDebugLogsEnabled = true

This will begin logging and saving debug statements that will be displayed in debug mode.

3. Present the Debug View Controller

The presentDebugViewController(parentViewController:) method returns a view containing debug mode. You can choose how you’d like to display this (e.g., through a button, a gesture, etc.). Here is an example of how to initialize and present it:

    PilgrimManager.shared().presentDebugViewController(parentViewController: self)

Android Feature Overview

The class PilgrimSdkDebugActivity contains the view for debug mode and is available to developers using the SDK. Developers who wish to display debug mode can do so with startActivity(new Intent(this, PilgrimSdkDebugActivity.class)).

For more detailed implementation instructions follow these steps:

1. Configure Pilgrim

See the quickstart guide to ensure Pilgrim is configured correctly.

2. Add debug dependency

Include com.foursquare:pilgrimsdk-debugging:2.1.0 in your build.gradle file’s dependencies.

3. Set the Log Level to DEBUG

Ensure that the log level is set to DEBUG.


This will set the log level to DEBUG to receive more detailed logs while developing and persist the logs on disk.

4. Decide View Options

You can show debug mode through a gesture or button. Decide on how you want to show debug mode and ensure you have the application’s context available to start the activity.

5. Create a New Intent

This prepares an intent to bind with the debugMode view.

    Intent debugMode = new Intent(this, PilgrimSdkDebugActivity.class)

To avoid errors, the variable this should be of type Context

6. Start Activity with New Intent