Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the loglevel of GoogleTagManager v5 on iOS

I've integrated GoogleTagManager v5 in an iOS project. It's working fine, but now I see these logmessages in the Xcode console:

2017-07-14 09:09:19.285 App[23194:15302685] GoogleTagManager info: Loading container: GTM-XXX
2017-07-14 09:09:19.286 App[23194:15302665] GoogleTagManager info: Attempting to load saved version of container GTM-XXX
2017-07-14 09:09:19.310 App[23194:15302665] GoogleTagManager info: Processing logged event: gtm.load with parameters: (null)
2017-07-14 09:09:19.324 App[23194:15302665] GoogleTagManager info: Sending universal analytics hit: {
    "&t" = screenview;
    "&tid" = "UA-000000-1";
}
[...]

To reduce the amount of clutter in my console would like to change the loglevel for GoogleTagManager to warnings and errors only, but I can't find how to do this?

I've tried:

  • Setting GAI.sharedInstance().logger.logLevel but that doesn't have effect on these logs.
  • Setting FirebaseConfiguration.shared.setLoggerLevel does silence Firebase logs, but not these GoogleTagManager logs.
  • Passing the -FIRAnalyticsDebugDisabled argument also doesn't have effect on GoogleTagManager logs.
  • Searched for pointers in the GoogleTagManager.h file, but there only seems to be one protocol in the TagManager CocoaPod since v5. So no logging options there.

Any ideas on how to change the Google Tag Manager log level or how to disable logging entirely?

like image 298
Mac_Cain13 Avatar asked Jul 14 '17 07:07

Mac_Cain13


1 Answers

The only answer that I was able to find is a dark magic with swizzling: https://stackoverflow.com/a/45411324/1016656

like image 118
SPopenko Avatar answered Oct 18 '22 11:10

SPopenko