Siesta

Logging

Siesta features extensive logging. It is disabled by default, but you can turn it on with:

SiestaLog.Category.enabled = .common

…or for the full fire hose:

SiestaLog.Category.enabled = .all

Common practice is to add a DEBUG Swift compiler flag to your project (if you haven’t already done so):

Build Settings → Swift Compiler Flags - Custom Flags → Other Swift Flags → Debug → -DDEBUG

…and then automatically enable logging for common categories in your API’s init() or your applicationDidFinishLaunching:

#if DEBUG
    SiestaLog.Category.enabled = .common
#endif

Custom Log Action

By default, Siesta logs to stdout using print(...), but you can augment or override the default by providing your own logging closure.

For example, if you want to drive yourself and everyone around you into a wild rage:

let speechSynth = AVSpeechSynthesizer()
let originalLogger = SiestaLog.messageHandler
SiestaLog.messageHandler = { category, message in
    originalLogger(category, message)
    speechSynth.speak(AVSpeechUtterance(string: message))
}

Next: UI Components