Enabling Debug Logging on iOS
To enable logging for debugging, you may pass a .logLevel
key to the zenKeyOptions
parameter in your ZenKeyAppDelegate
. Doing so adds further detail when diagnosing warnings and errors that may occur during the flow of execution.
ZenKeyAppDelegate.shared.application(
application,
didFinishLaunchingWithOptions: launchOptions,
/// the launchOptions received by your application's app delegate
zenKeyOptions: BuildInfo.zenKeyOptions
/// zenKeyOptions: ZenKey specific options. Pass a log level to ZenKey launch options to enable logging during debugging.
)
For instance, you might use NetworkLog.logLevel = .warn
to log network messages. Other logging options include verbose, debug, info, error, and fatal.
public struct Log {
static private(set) var logLevel: Level = .off
public enum Level: Int {
case off, error, warn, info, verbose
var name: String {
switch self {
case .off:
return ""
case .warn:
return "warn"
case .error:
return "error"
case .info:
return "info"
case .verbose:
return "verbose"
}
}
}
static func configureLogger(level: Level) {
logLevel = level
}
Updated about 1 year ago
Did this page help you?