'Amplitude analytics for iOS: setting up logging level
Is there a way to set up logging level for Amplitude iOS SDK similar to Android's Amplitude.getInstance().enableLogging()
and Amplitude.getInstance().setLogLevel()
, as I'd like to see how my analytics implementation works in console output in debug mode.
Solution 1:[1]
Here is the official answer from support:
Yes, it is possible to set up a log level for Amplitude. At the top of each file in the SDK, you can change the AMPLITUDE_DEBUG flag, and you can also change the AMPLITUDE_LOG_ERRORS flag to turn off error logging.
Solution 2:[2]
From Amplitude documentation - https://developers.amplitude.com/docs/ios
Debug Logging By default, only critical errors are logged to console. To enable debug logging in iOS, change AMPLITUDE_DEBUG from 0 to 1 at the top of the Objective-C file you wish to examine. Error messages are printed by default. To disable error logging, change AMPLITUDE_LOG_ERRORS from 1 to 0 in Amplitude.m.
How To Enable Macros In The Project Step 1. Navigate to your Target and then select the Build Settings.
Step 2. In search bar type preprocessor, it will show you the Preprocessor macro.
Step 3. Enlist the macros you defined here.
Macros in Swift Programming
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | deko |
Solution 2 | Ankit Jain |