Logging
Direct logging
Section titled “Direct logging”Auralog.debug("cache refreshed")Auralog.info("user signed in", metadata: ["user_id": "123"])Auralog.warn("region lookup slow", metadata: ["duration_ms": 842])Auralog.error("payment failed", metadata: ["order_id": "abc"])Auralog.fatal("unrecoverable startup failure")Metadata values use AuralogValue, which supports strings, integers, doubles, booleans, arrays, objects, and nulls:
Auralog.info("checkout started", metadata: [ "screen": "checkout", "cart_items": 4, "from_cache": false])SwiftLog
Section titled “SwiftLog”If your app or dependencies already use Apple’s swift-log, add the AuralogSwiftLog product and bootstrap it:
import AuralogSwiftLogimport Logging
AuralogSwiftLog.install()
let logger = Logger(label: "app.home")logger.info("home loaded", metadata: ["screen": "home"])SwiftLog only allows one global logging backend. If your app already installs one, compose Auralog from that logging setup instead of calling AuralogSwiftLog.install() twice.
Shutdown
Section titled “Shutdown”For normal iOS apps, background flushing is usually enough. For deterministic drains in tests, app extensions, command-line tools, or short-lived tasks:
await Auralog.flush()await Auralog.shutdown()