Logging
This page explains how customers can leverage the option to log additional data from the mobile SDK for the purpose of performance monitoring, issue investigation and analytics
Logging is disabled by default.
Please note logs do not include any Personally Identifiable Information (PII).
How it works
Firstly, there are two options available related to logging data:
If you want to enable logging to the Keyless infrastructure use
keylessLogsConfiguration. This options ensures Keyless has access to richer SDK logs to support investigations on our side, and also enriches the Keyless dashboard.Alternatively, if you wish to collect logging for you own analytics without sending them to the Keyless infrastructure use
customLogsConfiguration
val setup = SetupConfig(
apiKey = "...",
hosts = listOf(""),
keylessLogsConfiguration = LogsConfiguration(
enabled = true,
logLevel = LogLevels.INFO
),
customLogsConfiguration = LogsConfiguration(
enabled = true
)
)let configuration = SetupConfig(
apiKey: "some api key",
hosts: ["some.host"],
keylessLogsConfiguration: KeylessLogsConfiguration(enabled: true),
customLogsConfiguration: CustomLogsConfiguration(enabled: true, logLevel: .INFO, callback: { event in
print(event)
})
)
Keyless.configure(setupConfiguration: configuration) { error in
// handle error
}val setupConfiguration = SetupConfiguration.builder
.withApiKey("")
.withHosts(listOf("..."))
.withLogging(
keylessLogsConfiguration = LogsConfiguration(enabled = true),
customLogsConfiguration = LogsConfiguration(enabled = true, logLevel = LogLevels.INFO)
)
.build()let configuration = Keyless.SetupConfiguration
.builder
.withApiKey("some api key")
.withHosts(["some.host"])
.withLogging(
keylessLogsConfiguration: KeylessLogsConfiguration(enabled: true, logLevel: .INFO),
customLogsConfiguration: CustomLogsConfiguration(enabled: true, callback: { event in
print(event)
})
)
.build()
Keyless.configure(setupConfiguration: configuration) { error in
// handle error
}final configuration = SetupConfiguration(
apiKey: apiKey,
hosts: [host],
loggingEnabled: true,
loggingLevel: LogLevel.info));
try {
final result = await Keyless.instance.configure(configuration);
print("Configure finished succcessfully.");
} catch (error) {
print("Configure finished with error: $error");
} const config = new SetupConfig({
apiKey: 'apiKey',
hosts: ['HOSTS'],
keylessLogsConfiguration: new LogsConfiguration({
enabled: true,
logLevel: LogLevels.INFO,
}),
customLogsConfiguration: new LogsConfiguration({
enabled: true,
logLevel: LogLevels.TRACE,
}),
});
const result = await Keyless.configure(config);
result.fold({
onSuccess: _data => {
//Handle success
},
onFailure: _error => {
//Handle error
},
Collect logs after setting up custom logging with customLogsConfiguration option:
Start collecting the
Keyless.customLogsflow (This must happen before aKeyless.configure()to get all Logs Events):
Keyless.customLogs.collect { logEvent ->
// handle the logEvent
}Configure the SDK with the following
SetupConfig:
val setup = SetupConfig(
apiKey = "...",
hosts = listOf(""),
customLogsConfiguration = LogsConfiguration(
enabled = true,
logLevel = LogLevels.INFO // This is optional and defaults to INFO
)
)var myEventCollection = [LogEvent]()
let configuration = Keyless.SetupConfiguration
.builder
.withApiKey("some api key")
.withHosts(["some.host"])
.withLogging(
keylessLogsConfiguration: KeylessLogsConfiguration(enabled: true, logLevel: .INFO),
customLogsConfiguration: CustomLogsConfiguration(enabled: true, callback: { event in
myEventCollection.append(event)
})
)
.build()
Keyless.configure(setupConfiguration: configuration) { error in
// handle error
}
}Start collecting Keyless suctom logs flow (This must happen before a
Keyless.configure()to get all Logs Events)
const eventSubscription = Keyless.subscribeToCustomLogs(eventLog => {
// Handle log
});
const config = new SetupConfig({
apiKey: 'apiKey',
hosts: ['HOSTS'],
customLogsConfiguration: new LogsConfiguration({
enabled: true,
logLevel: LogLevels.TRACE,
}),
});
const result = await Keyless.configure(config);
result.fold({
onSuccess: _data => {
//Handle success
},
onFailure: _error => {
//Handle error
},
When you want to unsubscribe from logs make sure you call:
eventSubscription?.unsubscribe();Logging Levels
You may set different logging levels to provide more or less information in logs.
The available levels are the following:
INFO(default)DEBUGTRACE
The TRACE level provides the following additional data:
userIddevicePublicSigningKeycoreLogHistory(used for detailed debugging)
Last updated
Was this helpful?