Skip to main content

How do I configure SDK device logging?

By default, the Swrve SDK performs native device logging on iOS (Console Logs), Android (Logcat) and Unity. If required, you can disable these logs. On Android and iOS, you can also change the default logging level.

Additionally, the Swrve Unity SDK creates a small delay of approximately 14 milliseconds (ms) when logging. This is a not a big issue, however it can cause some performance implications if you're firing events and your app operates at a high speed (for example, 60 frames per second, as you only have 16ms per frame). This article explains how to disable SDK device logs for iOS, Android and Unity.

If using source code

To disable the console logs completely on iOS, add a constant called SWRVE_DISABLE_LOGS to the preprocessor macros under App Target > Build Settings > Preprocessing > Preprocessor Macros.

If using CocoaPods

Add the following code to your podfile and reinstall the pod.

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'SWRVE_DISABLE_LOGS=1']
end
end
end

If using Carthage

In the SwrveFrameworks project in the Carthage/Checkouts/swrve-ios-sdk/SwrveFrameworks folder, add a constant called SWRVE_DISABLE_LOGS to the preprocessor macros, and then run a Carthage build to update your main project.

Configure log level at runtime

As of iOS SDK 7.0.0, you can configure the runtime log level. Call [SwrveLogger setLogLevel:VERBOSE] with any of the following SwrveLogLevel enums:

  • NONE
  • ERROR
  • WARNING
  • VERBOSE