Skip to main content

iOS - Module Observability

Mobile SDK iOS 26.9.0 adds structured observability APIs on ModuleDelegate.

Structured Module Logging

For new work in 26.9.0+, prefer the structured ModuleDelegate logging helpers over the older logging entry points.

moduleDelegate?.log(
"native login step started",
severity: .info,
provenance: ModuleProvenance(
source: "module",
feature: "nativeLogin",
screen: "stepUp",
action: "begin"
)
)

Provenance Fields

ModuleProvenance lets a module describe where the log came from:

  • source
  • feature
  • flow
  • screen
  • action
  • cause
  • outcome

All fields are optional. Supply only the fields your module already knows.

Spans

Use withSpan when you want the host app to treat a block of work as a single operation boundary.

let result = try await moduleDelegate?.withSpan(
"nativeLogin.submit",
provenance: ModuleProvenance(feature: "nativeLogin", action: "submit")
) {
try await submitCredentials()
}

Both sync and async withSpan overloads are available.

Deprecated Logging APIs

The following APIs still exist in 26.9.0, but they are deprecated for new usage:

  • ModuleDelegate.log(message:)
  • ModuleDelegate.log(error:data:)
  • Q2ModuleBase.log(_:level:)
  • Q2ModuleBase.logError(error:attributes:)

If you already use them, you do not need to remove them immediately for 26.9.0, but new module code should move to the structured observability helpers shown above.