Configuration
try Auralog.initialize(AuralogConfig( apiKey: "aura_your_api_key", environment: "production", globalMetadata: ["service": "ios-app"], captureMetricKit: true, captureUnhandledExceptions: true))| Option | Type | Default | Description |
|---|---|---|---|
apiKey | String | required | Auralog project API key |
environment | String | "production" | Environment label |
endpoint | URL | https://ingest.auralog.ai | Ingest endpoint override |
allowInsecureEndpoint | Bool | false | Permit http:// endpoints for local development |
flushInterval | TimeInterval | 5 | Time between batch flushes |
maxBatchSize | Int | 50 | Maximum logs per batch request |
maxQueueSize | Int | 1000 | Maximum pending non-error logs before dropping oldest |
maxRetryAttempts | Int | 5 | Retry cap for retryable delivery failures |
retryInitialDelay | TimeInterval | 1 | First retry delay |
retryMaxDelay | TimeInterval | 30 | Maximum retry delay |
httpTimeout | TimeInterval | 30 | URLSession request/resource timeout |
traceId | String | generated | Trace ID attached to every log |
globalMetadata | AuralogMetadata | none | Static metadata merged into every log |
globalMetadataProvider | () -> AuralogMetadata? | none | Synchronous metadata supplier invoked per log |
captureMetricKit | Bool | false | Forward Apple MetricKit metrics and diagnostics where available. In this beta, forwarding is implemented for iOS and no-ops on other platforms |
captureUnhandledExceptions | Bool | false | Capture uncaught Objective-C exceptions |
Global metadata
Section titled “Global metadata”Use global metadata for fields that should appear on every entry:
try Auralog.initialize( apiKey: "aura_your_api_key", globalMetadata: [ "app": "ios-app", "app_version": .string(Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "unknown") ], globalMetadataProvider: { ["user_id": currentUserId.map(AuralogValue.string) ?? .null] })The supplier runs synchronously on every log emission. Keep it cheap and avoid I/O. Per-call metadata wins on key collisions.
Transport behavior
Section titled “Transport behavior”- Non-error logs are queued and flushed every
flushInterval. errorandfatallogs are prioritized onto/v1/logs/single.Auralog.flush()drains pending single and batch queues.- 4xx responses and redirects are treated as permanent failures.
- 5xx responses and network failures retry up to
maxRetryAttempts. - The project API key is sent as
projectApiKey, matching the other Auralog SDKs.