在iOS上更改GoogleTagManager v5的日志级别

时间:2021-03-19 15:50:48

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

我在一个iOS项目中集成了GoogleTagManager v5。它工作正常,但现在我在Xcode控制台中看到这些logmessages:

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?

为了减少我的控制台中的杂乱程度,我想将GoogleTagManager的loglevel更改为仅警告和错误,但我找不到如何执行此操作?

I've tried:

我试过了:

  • Setting GAI.sharedInstance().logger.logLevel but that doesn't have effect on these logs.
  • 设置GAI.sharedInstance()。logger.logLevel,但这对这些日志没有影响。
  • Setting FirebaseConfiguration.shared.setLoggerLevel does silence Firebase logs, but not these GoogleTagManager logs.
  • 设置FirebaseConfiguration.shared.setLoggerLevel会使Firebase日志静音,但不会使这些GoogleTagManager日志静音。
  • Passing the -FIRAnalyticsDebugDisabled argument also doesn't have effect on GoogleTagManager logs.
  • 传递-FIRAnalyticsDebugDisabled参数也不会对GoogleTagManager日志产生影响。
  • 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.
  • 搜索了GoogleTagManager.h文件中的指针,但自v5以来,TagManager CocoaPod中似乎只有一个协议。所以那里没有日志选项。

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

有关如何更改Google跟踪代码管理器日志级别或如何完全禁用日志记录的任何想法?

1 个解决方案

#1


4  

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

我能找到的唯一答案就是一个带有调皮的黑暗魔法:https://*.com/a/45411324/1016656

#1


4  

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

我能找到的唯一答案就是一个带有调皮的黑暗魔法:https://*.com/a/45411324/1016656