Logging
| Logging is disabled by default. |
| Logs do not include any Personally Identifiable Information (PII). |
How It Works
There are two options for logging:
-
To enable logging to PingOne Recognize infrastructure, use
keylessLogsConfiguration. This gives PingOne Recognize richer SDK logs for investigation and enriches the PingOne Recognize dashboard. -
To collect logs only for your analytics (without sending to PingOne Recognize infrastructure), use
customLogsConfiguration.
Android
val setup = SetupConfig(
apiKey = "...",
hosts = listOf(""),
keylessLogsConfiguration = LogsConfiguration(
enabled = true,
logLevel = LogLevels.INFO
),
customLogsConfiguration = LogsConfiguration(
enabled = true
)
)
iOS
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
}
Android 4.6
val setupConfiguration = SetupConfiguration.builder
.withApiKey("")
.withHosts(listOf("..."))
.withLogging(
keylessLogsConfiguration = LogsConfiguration(enabled = true),
customLogsConfiguration = LogsConfiguration(enabled = true, logLevel = LogLevels.INFO)
)
.build()
iOS 4.6
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
}
Flutter
final configuration = SetupConfiguration(
apiKey: apiKey,
hosts: [host],
loggingEnabled: true,
loggingLevel: LogLevel.info,
);
try {
final result = await Keyless.instance.configure(configuration);
print("Configure finished successfully.");
} catch (error) {
print("Configure finished with error: $error");
}
React Native
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 Custom Logs
Collect logs after enabling customLogsConfiguration:
Android
-
Start collecting
Keyless.customLogs(this must happen beforeKeyless.configure()to get all log events):Keyless.customLogs.collect { logEvent -> // handle logEvent } -
Configure SDK with
SetupConfig:val setup = SetupConfig( apiKey = "...", hosts = listOf(""), customLogsConfiguration = LogsConfiguration( enabled = true, logLevel = LogLevels.INFO // optional, defaults to INFO ) )
iOS
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
}
React Native
-
Start collecting PingOne Recognize custom logs (this must happen before
Keyless.configure()to get all log 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, call:
eventSubscription?.unsubscribe();