Skip to main content

Logging

Switchboard SDK provides customizable and extensive logging to keep track of the internal processes. The Logger outputs to the console by default.

Log Levels

The log levels are the following:

Log levelsDescription
NoneSet this to disable logging
ErrorCritical errors, crashes
WarningWarnings that can cause potentional unwanted results, e.g. clipping
InfoGeneral informational logs
DebugUseful informations for debugging purposes
TraceVerbose logs, for more in-depth look on functionality

Setting the Log Level

The default log level is Info, but you can change this to your desire.

SBLogger.setLogLevel(SBLogLevelDebug)

Custom Log Destination

It's also possible to set a custom log destination, for example writing every log into a file, while filtering what you want to display on the console.

SBLogger.setLogDestination(
CallbackLogDestination(logCallback: { (logLevel: SBLogLevel, message: String) in
// custom logging
})
)

Using Switchboard SDK for Logging

If you are developing a custom extension for Switchboard SDK we suggest that you use the Logger provided by the SDK.

SBLogger.error("Error log")
SBLogger.warning("Warning log")
SBLogger.info("Info log")
SBLogger.debug("Debug log")
SBLogger.trace("Trace log")