Skip to main content

Logging

The SDK provides a way to log user and SDK common actions (lifecycle events, navigation, camera changes). This can be useful for understanding specific scenarios or troubleshooting potential issues. To enable logging, provide your implementation of the IdenfyLoggingHandlerUseCase class:
        let consoleLogging = ConsoleLoggingImpl()
        idenfyController.setIdenfyLoggingHandler(idenfyLoggingHandler: IdenfyLoggingHandlerUseCaseImpl(consoleLogging))
class ConsoleLoggingImpl {
    func log(event: String, message: String, token _: String) {
        print("SDKLog", event, " - ", message)
    }
}
import iDenfySDK

class IdenfyLoggingHandlerUseCaseImpl: IdenfyLoggingHandlerUseCase {
    private var consoleLogging: ConsoleLoggingImpl!

    init(_ consoleLogging: ConsoleLoggingImpl) {
        self.consoleLogging = consoleLogging
    }

    func logEvent(event: String, message: String, token: String) {
        #if DEBUG
            consoleLogging.log(event: event, message: message, token: token)
        #endif
    }
}

User events webhooks

The SDK provides webhooks about events occurring throughout the verification process. Results are delivered while the verification process is active and the application is presenting SDK views.

Declare a class for receiving events

Declare a class that implements IdenfyUserFlowHandler to call your backend service, log events, or apply changes:
import iDenfySDK

@objc public class IdenfyUserFlowCallbacksHandler: NSObject, IdenfyUserFlowHandler {
    public func onPhotoUploaded(photo: String, step: String) {
        print("IdenfyUserFlowHandler - onPhotoUploaded \(step)")
    }

    public func onDocumentSelected(documentType: String) {
        print("IdenfyUserFlowHandler - onDocumentSelected \(documentType)")
    }

    public func onCountrySelected(issuingCountryCode: String) {
        print("IdenfyUserFlowHandler - onCountrySelected \(issuingCountryCode)")
    }

    public func onProcessingStarted(processingStarted: Bool) {
        print("IdenfyUserFlowHandler - onProcessingStarted \(processingStarted)")
    }
}

Set the idenfyUserFlowCallbacksHandler

Set the idenfyUserFlowCallbacksHandler in the IdenfyController class:
...
idenfyController.setIdenfyUserFlowCallbacksHandler(idenfyUserFlowHandler: IdenfyUserFlowCallbacksHandler())
...