Skip to main content
←API Reference ←NSDK

NSDKLogCallback


Declaration​

protocol NSDKLogCallback : AnyObject

Summary​

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(accessToken: "your-token", logCallback: callback)

Methods​

NameTypeSummary
onLogvoid
Called when NSDK generates a log message.