Logging
Configure log levels and privacy settings to control how the Airship SDK logs messages.
The Airship SDK provides configurable log levels to help you debug issues without overwhelming the console. By default, the log level is set to Info for development builds and Error for production builds to ensure clean logs in a live environment.
Log levels
The following log levels are available, ordered from most to least verbose.
| Log Level | Description |
|---|---|
| Verbose | Reports highly detailed SDK status, which is useful for deep debugging and troubleshooting. |
| Debug | Reports general SDK status with more detailed information than Info. |
| Info | Reports general SDK status and lifecycle events. |
| Warning | Used for API deprecations, invalid setup, and other potentially problematic situations that are generally recoverable. |
| Error | Used for critical errors, exceptions, and other situations that the SDK cannot gracefully handle. |
| None | Disables all logging. |
Configuring log levels
You can set the log level in the Airship config options that are passed during takeOff. This setting acts as a minimum, and only logs at that level and higher will be logged.
// Available log levels: verbose, debug, info, warning, none
await Airship.takeOff({
default: {
logLevel: "verbose"
},
...
});Due to how takeOff caches config, you may need to restart the app after the new takeOff before the log levels take effect.
Log privacy levels
For better security in production environments, you can control the visibility of log contents using privacy levels. This is especially useful when you need to debug a release build without exposing sensitive information.
private (default)
This is the default setting, designed to protect data in a production environment.
- iOS: Uses
os.Loggerto log all messages at theprivatelevel. The content of most logs will be redacted and will not be visible in the Console app unless a special profile is installed on the device. - Android: Uses the standard
android.util.Log. In production builds,verboseanddebugmessages are completely dropped and will not be logged.
public
This setting increases log visibility, making it easier to capture detailed information from release builds.
- iOS: All logs are sent to
os.Loggerwith apublicprivacy level, preventing their content from being redacted. - Android & iOS: To ensure visibility in production builds,
verboseanddebugmessages are automatically elevated to theinfolog level.
Setting the privacy level
You can set the privacy level in the Airship config options that are passed during takeOff.
await Airship.takeOff({
default: {
logLevel: "verbose",
ios: {
logPrivacyLevel: "public"
},
android: {
logPrivacyLevel: "public"
}
},
...
});Due to how takeOff caches config, you may need to restart the app after the new takeOff before the log levels take effect.
Categories