Skip to content

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
])

If your app or dependencies already use Apple’s swift-log, add the AuralogsSwiftLog product and bootstrap it:

import AuralogsSwiftLog
import 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.

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()