Skip to content

Logging

SwiftSonic does not log anything by default. No print, no os_log, no Logger. If you embed it in a production app, it stays silent.

When you need to debug a request flow, you opt in by passing a logging hook through ServerConfiguration.

TODO: confirm the exact logging API in 0.6.x. The shape is likely either a closure ((LogEvent) -> Void) or a Logger protocol. Verify against Sources/SwiftSonic/Logging/ (or wherever it lives).

// TODO: replace with verified shape
let config = ServerConfiguration(
host: "music.example.com",
username: "user",
password: "pass",
logger: { event in
print(event)
}
)

TODO: enumerate the log events emitted (request started, response received, retry attempted, error classified) once verified.

Sensitive values are scrubbed: the password never appears in logs, and tokens are redacted. URLs may include the username component (u=...) — treat logs as you would any production access log.

TODO: confirm the redaction guarantees and which fields are scrubbed.