Logging (Driver Layer)#
HaapiLogger is shared across all layers — Driver, SDK, and UIKit/UIWidget — so a single configuration covers the entire stack. Configure it once at app startup. For the concept (severity ordering, follow-up tags, sensitive-value masking, custom sinks), see Logging and Observability .
Configuration#
Configure in AppDelegate.application(_:didFinishLaunchingWithOptions:):
HaapiLogger.followUpTags = DriverFollowUpTag.allCases
HaapiLogger.setLogType(LogType.info)Setting a log type enables that level and everything more severe (info enables info, warning, and error). The deprecated isXXXEnabled flags still compile but are scheduled for removal — see Upgrade — HaapiLogger setLogType Migration .
HaapiLogger.followUpTags is an emission gate — it defaults to [], meaning nothing logs until you set it. Setting DriverFollowUpTag.allCases enables every Driver tag (HAAPI_DRIVER_FLOW, HAAPI_DRIVER_HTTP, HAAPI_DRIVER_STORAGE, HAAPI_DRIVER_ATTESTATION); pass a narrower subset to restrict emission to specific subsystems.
Configure in Application.onCreate:
class ClientApplication : Application() {
override fun onCreate() {
super.onCreate()
HaapiLogger.enabled = true
HaapiLogger.setLevel(HaapiLogger.LogLevel.INFO)
}
}Setting a log level enables that level and everything more severe (INFO enables INFO, WARN, and ERROR). In DEBUG builds, enabled defaults to true and the level defaults to VERBOSE; in release builds, both default off.
Tag prefixes label each record but have no behavioural effect on emission — the only emission gates are enabled and setLevel(...). The Driver tags are HAAPI_DRIVER_FLOW, HAAPI_DRIVER_HTTP, HAAPI_DRIVER_STORAGE, HAAPI_DRIVER_KEYSTORE, HAAPI_DRIVER_DCR, HAAPI_DRIVER_ATTESTATION. To restrict output to a subset, filter inside your LogSink.log(...) or at the LogCat command line (logcat -s 'HAAPI_DRIVER_HTTP:V').
Sensitive-Value Masking#
HaapiLogger.isSensitiveValueMasked defaults to true and should remain true in any non-development build. When disabled, the logger emits an explicit warning every time it prints an unmasked sensitive value so the misconfiguration is hard to miss.
Setting isSensitiveValueMasked = false in a release build leaks access tokens, refresh tokens, DPoP keys, and other sensitive values into application logs. Keep masking on outside of local debugging.
Custom Sinks#
To route logs into a host application’s observability platform or crash reporter, register a LogSink implementation. The sink receives every log record with its level, follow-up tag, message, file, and line; it can filter, transform, or forward as needed. See Logging and Observability for the sink interface.
How to implement this: Logging and Observability (concept) · How to Customize Logging · Upgrade — HaapiLogger setLogType Migration