Protocol
PCLoggerProtocol
public protocol PCLoggerProtocol
The protocol to implement external logger
To use your logger, implement your own object that will inherit this protocol. For example:
final class MyLogger: PCLoggerProtocol {
func debug(_ message: String, category: PCLoggingCategory) {
...
}
func error(_ message: String, category: PCLoggingCategory) {
...
}
func sensitive(_ message: String, category: PCLoggingCategory) {
#if DEBUG
// Process sensitive information only in DEBUG mode to keep safe
// user's sensitive data, e.g. symmetric keys values, personal data etc.
...
#endif
}
}
Then pass it to the PCSDK.setLogger(...)
method:
let myLogger = MyLogger()
PCSDK.setLogger(myLogger, options: [.debug, .sensitive])
Requirements
debug(_:category:)
func debug(_ message: String, category: PCLoggingCategory)
Common messages
Parameters
Name | Type | Description |
---|---|---|
message | String |
The message |
category | PCLoggingCategory |
The category |
error(_:category:)
func error(_ message: String, category: PCLoggingCategory)
Errors
Parameters
Name | Type | Description |
---|---|---|
message | String |
The message |
category | PCLoggingCategory |
The category |
sensitive(_:category:)
func sensitive(_ message: String, category: PCLoggingCategory)
Sensitive information. E.g. keys, requests with user's personal info.
Parameters
Name | Type | Description |
---|---|---|
message | String |
The message |
category | PCLoggingCategory |
The category |