- 2 Minutes to read
- Print
- DarkLight
Debug iOS v4
- 2 Minutes to read
- Print
- DarkLight
The debug mode helps you to verify your track requests and check if all of your parameters are sent correctly.
Please use the AppDelegate.Swift class to initiate the debug mode.
Prepare Logging
The following code is needed to be able to filter logging information in the console:
if let id = everID, let code = mediaCode {
WebtrekkTracking.defaultLogger.logDebug( "\(everIDName)=\(id), \(mediaCodeName)=\(code)" )
} else {
WebtrekkTracking.defaultLogger.logDebug( "no deep link info" )
}
}
This will add both, the prefix "Webtrekk" and the corresponding type of logging information into the console.
Example output in the console:
[Webtrekk] [Warning] Element autoTrackPlaystoreUsername not found
[Webtrekk] [Warning] Element autoTrackPlaystoreMail not found
[Webtrekk] [Debug] track domain is:https: //trackdomain.net
[Webtrekk] [Debug] trackID is: 988720192734534
[Webtrekk] [Debug] sendDelay is: 300.0
In the example above, "Webtrekk" is used to indicate the output of the Mapp Intelligence SDK, and "Warning" and "Debug" are used to indicate the type of output.
Enable Webtrekk Logging
If you want to enable logging for all types of notifications, you need to set the SDK test mode to "true":
func initWithConfig(configName name: String? = nil) {
if let _ = WebtrekkTracking.tracker {
releaseWebtrekkInstance()
}
do {
WebtrekkTracking.defaultLogger.testMode = true
if let name = name {
let configFileURL = Bundle.main.url(forResource: name, withExtension: "xml" , subdirectory: "Configurations/" )
try WebtrekkTracking.initTrack(configFileURL)
} else {
try WebtrekkTracking.initTrack()
}
} catch let error as TrackerError {
WebtrekkTracking.defaultLogger.logError( "Error Webtrekk SDK initialization: \(error.message)" )
} catch {
WebtrekkTracking.defaultLogger.logError( "Unkown error during Webtrekk SDK initialization" )
}
}
This will start logging the following information to the console:
Logging Type | Information Provided |
---|---|
debug |
|
info |
|
warning |
|
error |
|
fault |
|
Disable Logging
In production, it is recommended to disable logging entirely. To do so, please disable logging and testMode:
WebtrekkTracking.defaultLogger.enabled = false
WebtrekkTracking.defaultLogger.testMode = false
Example App
In the Webtrekk Example App, you can check how logging works when you change the configuration in the AppDelegate.Swift class at line 122 and 123 before running the app in Xcode:
https://github.com/Webtrekk/iOS-SDK-Example-App/blob/master/Sources/ModuleTest/AppDelegate.swift