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 LevelDescription
VerboseReports highly detailed SDK status, which is useful for deep debugging and troubleshooting.
DebugReports general SDK status with more detailed information than Info.
InfoReports general SDK status and lifecycle events.
WarningUsed for API deprecations, invalid setup, and other potentially problematic situations that are generally recoverable.
ErrorUsed for critical errors, exceptions, and other situations that the SDK cannot gracefully handle.
NoneDisables all logging.

Configure log levels

You can set the log level in the Airship config when calling takeOff. This setting acts as a minimum threshold—only logs at that level and higher will be output.

import 'package:flutter/material.dart';
import 'package:airship_flutter/airship_flutter.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  var config = AirshipConfig(
    defaultEnvironment: ConfigEnvironment(
      appKey: "YOUR_APP_KEY",
      appSecret: "YOUR_APP_SECRET"
    ),
    site: Site.us,
    
    // Set log level for both platforms
    logLevel: LogLevel.verbose,
    
    // Optional: Set platform-specific log privacy levels
    iosConfig: IOSConfig(
      logPrivacyLevel: IOSLogPrivacyLevel.public
    ),
    androidConfig: AndroidConfig(
      logPrivacyLevel: AndroidLogPrivacyLevel.public
    )
  );

  Airship.takeOff(config);
  runApp(MyApp());
}
EnvironmentRecommended LevelPurpose
DevelopmentLogLevel.verbose or LogLevel.debugMaximum detail for debugging
Staging/QALogLevel.infoGeneral status information
ProductionLogLevel.error or LogLevel.warningOnly critical issues

Example: Conditional logging

Set different log levels based on build mode:

import 'package:flutter/foundation.dart';

var config = AirshipConfig(
  // ... other config ...
  
  // Use verbose logging in debug builds, errors only in release
  logLevel: kDebugMode ? LogLevel.verbose : LogLevel.error,
  
  iosConfig: IOSConfig(
    logPrivacyLevel: kDebugMode 
        ? IOSLogPrivacyLevel.public 
        : IOSLogPrivacyLevel.private
  ),
  androidConfig: AndroidConfig(
    logPrivacyLevel: kDebugMode 
        ? AndroidLogPrivacyLevel.public 
        : AndroidLogPrivacyLevel.private
  )
);

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 like channel IDs, named users, or custom event data.

Private (default)

This is the default setting, designed to protect data in a production environment. Sensitive information is redacted from log output.

Use case: Production builds where log output might be collected or viewed by support teams.

Public

This setting increases log visibility, making it easier to capture detailed information from release builds. Sensitive information is visible in logs. To ensure visibility in production builds, verbose and debug messages are automatically elevated to the info log level.

Use case: Development builds or when actively debugging issues in test environments.

 Warning

Only use public privacy level in development or controlled test environments. Never use it in production builds that will be distributed to end users, as it may expose sensitive user data in logs.

Viewing logs

View Airship SDK logs in your platform’s native development tools.

iOS logs

View iOS logs in Xcode’s console:

  1. Run your app in Xcode
  2. Open the Debug area (View → Debug Area → Show Debug Area or ⇧⌘Y)
  3. Filter logs by typing “Airship” in the search field

Android logs

View Android logs using Logcat:

  1. Run your app in Android Studio
  2. Open Logcat (View → Tool Windows → Logcat)
  3. Filter logs by selecting your app’s package or searching for “Airship”

Or use the command line:

adb logcat | grep Airship

Example log output

With verbose logging enabled, you’ll see detailed output like:

[Airship] Airship takeOff succeeded
[Airship] Channel ID: 01234567-89ab-cdef-0123-456789abcdef
[Airship] Push notifications enabled: true
[Airship] Analytics tracking event: screen_viewed

Troubleshooting logging issues

If you’re not seeing expected log output:

  • Verify log level: Ensure you’ve set an appropriate log level (e.g., LogLevel.verbose for debugging)
  • Check privacy level: If using release builds, set privacy level to public for full visibility
  • Filter console output: Use “Airship” as a filter keyword in your IDE’s console
  • Restart the app: Log configuration is set during takeOff, so restart the app after making changes