Logging

The Zeta React Native SDK routes diagnostic output to the native platform loggers — Apple's Unified Logging System on iOS and Logcat on Android. Control log verbosity and privacy from JavaScript before initialization.

All logging APIs are static methods on the ZTLogger class. No SDK initialization is required before calling them.

On this page

Enable logging

By default, the SDK produces no log output (NONE). Enable logging as early as possible — typically before calling ZetaClient.initialize(...):

import { ZTLogger, ZTLogLevel } from 'zetakit_reactnative';

ZTLogger.setLogLevel(ZTLogLevel.DEBUG);

Log levels

ZTLogger.setLogLevel() accepts a ZTLogLevel enum value. Only messages at or above the configured level are emitted.

LevelDescription
NONENo SDK messages (default)
VERBOSEAll messages including fine-grained diagnostics
DEBUGDevelopment diagnostics
INFONotable operational events
WARNINGPotential issues
ERRORFailures and error conditions
import { ZTLogger, ZTLogLevel } from 'zetakit_reactnative';

// Development — see all SDK logs
ZTLogger.setLogLevel(ZTLogLevel.VERBOSE);

// Production — silence SDK logs
ZTLogger.setLogLevel(ZTLogLevel.NONE);

Log privacy (iOS only)

ZTLogger.setLogPrivacy() controls whether SDK log message content is visible in Console.app and system diagnostic captures (sysdiagnose). On Android this is a no-op.

PrivacyDescription
PRIVATEMessage content redacted in system log captures. Default.
PUBLICMessage content fully visible in all system log captures. Use only in non-production builds.
import { ZTLogger, ZTLogPrivacy } from 'zetakit_reactnative';

ZTLogger.setLogPrivacy(ZTLogPrivacy.PUBLIC);

Important: Ensure no PII is present in SDK logs when using PUBLIC privacy.

Recommended setup

import ZetaClient, {
  ZTRegion,
  ZTAppEnvironment,
  ZTLogger,
  ZTLogLevel,
  ZTLogPrivacy,
} from 'zetakit_reactnative';

// Set log level based on build type
if (__DEV__) {
  ZTLogger.setLogLevel(ZTLogLevel.DEBUG);
  ZTLogger.setLogPrivacy(ZTLogPrivacy.PUBLIC);
} else {
  ZTLogger.setLogLevel(ZTLogLevel.NONE);
}

const config = {
  clientSiteId: 'your-site-id',
  clientSecret: 'your-secret',
  region: ZTRegion.US,
  optIn: true,
  appEnvironment: ZTAppEnvironment.PRODUCTION,
};

ZetaClient.initialize(config, () => {
  // SDK is ready
});

See also