NsdkLogCallback
Protocol for receiving log messages from NSDK....
Declaration
protocol NsdkLogCallback : AnyObjectSummary
Protocol for receiving log messages from NSDK. Implement this protocol to receive NSDK log messages in your application. The callback will be invoked on background threads, so ensure your implementation is thread-safe.
Example Usage
class MyLogCallback: NsdkLogCallback {
func onLog(level: NsdkLogLevel, message: String, fileName: String?, fileLine: Int, funcName: String?) {
let levelStr = level.description
let location = fileName.map { "\($0):\(fileLine)" } ?? ""
let funcInfo = funcName.map { " \($0)" } ?? ""
print("[NSDK-\(levelStr)] \(location)\(funcInfo): \(message)")
}
}
let callback = MyLogCallback()
let session = NsdkSession(apiKey: "your-key", logCallback: callback)