Logging
Direct logging
Section titled “Direct logging”Auralogs.debug("cache refreshed")Auralogs.info("user signed in", metadata: ["user_id": "123"])Auralogs.warn("region lookup slow", metadata: ["duration_ms": 842])Auralogs.error("payment failed", metadata: ["order_id": "abc"])Auralogs.fatal("unrecoverable startup failure")Metadata values use AuralogsValue, which supports strings, integers, doubles, booleans, arrays, objects, and nulls:
Auralogs.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 AuralogsSwiftLog product and bootstrap it:
import AuralogsSwiftLogimport Logging
AuralogsSwiftLog.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 Auralogs from that logging setup instead of calling AuralogsSwiftLog.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 Auralogs.flush()await Auralogs.shutdown()