Skip to content

Logs

The SDK includes an optional logging feature that lets apps save encrypted, lightweight log files locally. These logs can assist in diagnosing unexpected behavior or other issues during SDK usage.

Through a configurable API, applications can:

  • Specify which types of logs to collect.
  • Choose whether logs are saved to a publicly accessible folder.
  • Receive a notification when the logs are ready after a session completes.

To enable logging, use the withLogs(configuration, listener) method available on both FaceSessionBuilder and PolarSessionBuilder.

Creating a Session with Logs

Create a LogsConfiguration object and pass it to withLogs(configuration, listener). Optionally, provide a LogsListener to receive a callback when the logs are saved.

Java
try {
    LicenseDetails licenseDetails = new LicenseDetails("<ENTER_YOUR_LICENSE_KEY>");
    
    LogsConfiguration logsConfiguration = new LogsConfiguration( 
        LogsLevel.DEFAULT, 
        true 
    );
    
    Session session = new FaceSessionBuilder() 
        .withImageListener(this)
        .withVitalSignsListener(this)
        .withSessionInfoListener(this)
        .withLogs(logsConfiguration, this) 
        .build(licenseDetails);
} catch (Exception e) {
    Log.e("SDK", "Error creating session: " + e.getMessage());
}
Kotlin
try {
    val licenseDetails = LicenseDetails("<ENTER_YOUR_LICENSE_KEY>")
    
    val logsConfiguration = LogsConfiguration( 
        LogsLevel.DEFAULT,
        saveToPublicFolder = true 
    ) 
    
    val session = FaceSessionBuilder() 
        .withImageListener(this)
        .withVitalSignsListener(this)
        .withSessionInfoListener(this)
        .withLogs(logsConfiguration, this) 
        .build(licenseDetails)
} catch (e: Exception) {
    Log.e("SDK", "Error creating session: ${e.message}")
}

Logs Configuration

Use LogsConfiguration to control logging behavior.

Kotlin
class LogsConfiguration(
    val level: LogsLevel,
    val saveToPublicFolder: Boolean
)
  • level: The desired logging level (see Logs Level).
  • saveToPublicFolder: If true, logs are saved to a publicly accessible folder - under Download/BiosenseSignal (for easy access or sharing).

Logs Level

Defines the verbosity and types of logs to collect. Currently, only the default level is available - LogsLevel.DEFAULT.

Logs Listener

Implement the LogsListener interface to receive log information when the session ends.

Kotlin
interface LogsListener {
    fun onLogsReady(logsInfo: LogsInfo)
}

The SDK invokes this method after the logs are successfully saved.

Logs Info

The LogsInfo object provides details about the saved logs.

Kotlin
class LogsInfo(
    val logsPath: String,
    val measurementDuration: Long
)
  • logsPath: Full path to the saved log files.
  • measurementDuration: Duration of the measurement in seconds.