Skip to main content

Output Methods

Choose the minimum log level and the single destination used by the default AIBuds logger.

API Reference

Framework

AIBudsLog.xcframework

Declaration

Swift
/// The current log configuration.
static var logConfiguration: LogConfiguration { get }

/// Configures log storage, rotation, and output behavior.
final class LogConfiguration: NSObject {
    /// The severity threshold. Defaults to `.info`.
    var level: LogLevel

    /// The active output destination. Defaults to `.xlfacility`.
    var destination: LogDestination

    /// Relative log directory under Documents. Defaults to `.aibuds/logs`.
    var logsDirectory: String

    /// Maximum single file size. Defaults to 10 MB.
    var maxFileSize: UInt64

    /// Maximum retained age in days. Defaults to 3.
    var logFileMaxAge: Int
}

See logConfiguration, LogLevel, and LogDestination.

Log Levels

level is the minimum severity recorded. Levels below it are discarded.

LevelUse
.verboseFine-grained execution tracing.
.debugDevelopment diagnostics.
.infoNormal progress and operational information.
.warnA condition that may require attention.
.errorA failure that may still allow the app to continue.
.fatalA critical failure that may terminate the app.
.muteDisable all log output.

Destinations

DestinationOutputExport support
.consoleXcode debugger consoleNo
.osloggerApple unified logging through os_logNo
.fileFiles under the configured Documents-relative directoryYes
.xlfacilityAIBudsXLFacility persistence pluginYes, when plugin is installed

Usage Examples

Swift
import AIBudsLog
import AIBudsXLFacility

let configuration = AIBudsLogSDK.logConfiguration
configuration.level = .debug
configuration.destination = .xlfacility
configuration.logFileMaxAge = 7

AIBudsLogSDK.setXLFacilityPlugin(XLFacilitySDK.shared)

AIBudsLogSDK.logService.info(
    "SDK configured",
    subsystem: "com.example.app",
    category: "startup"
)

Notes

  • Destination selection is process-wide and replaces the previous destination; it is not a set of simultaneously enabled outputs.
  • logsDirectory accepts a Documents-relative path. A leading slash is removed by the SDK.
  • Values less than or equal to zero are ignored for maxFileSize and logFileMaxAge.
  • The public SDK does not expose remote-server logging configuration or category enable/disable switches.