Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Completely disable Firebase/Analytics to stop console spam on app startup

I've installed Google/SignIn cocoapod into my application (which I need to support GoogleDrive), but it depends on Google/Core which depends on FirebaseAnalytics. I don't want or need FirebaseAnalytics.

FirebaseAnalytics spams the developer console with 8 lines of output when our app starts:

2017-06-07 18:07:19.612994+0100 son[2909:877661] [Firebase/Analytics][I-ACS005000] The AdSupport Framework is not currently linked. Some features will not function properly. Learn more at http://gooX.gl/9vSsPb 2017-06-07 18:07:19.613 son[2909] <Warning> [Firebase/Analytics][I-ACS005000] The AdSupport Framework is not currently linked. Some features will not function properly. Learn more at http://gooX.gl/9vSsPb 2017-06-07 18:07:19.613896+0100 son[2909:877661] [Firebase/Analytics][I-ACS023007] Firebase Analytics v.3900000 started 2017-06-07 18:07:19.614 son[2909] <Notice> [Firebase/Analytics][I-ACS023007] Firebase Analytics v.3900000 started 2017-06-07 18:07:19.614525+0100 son[2909:877661] [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://gooX.gl/RfcP7r) 2017-06-07 18:07:19.614 son[2909] <Notice> [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://gooX.gl/RfcP7r) 2017-06-07 18:07:19.622560+0100 son[2909:877662] [Firebase/Analytics][I-ACS023013] Firebase Analytics disabled 2017-06-07 18:07:19.623 son[2909] <Notice> [Firebase/Analytics][I-ACS023013] Firebase Analytics disabled 

(I had to add X to the URLs in the above output to get past stackoverflow's URL shortener blocker.)

I tried setting FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED to YES in my Info.plist, that removed 2 lines, but added another 2 lines to tell me that Analytics is disabled (FFS!).

This spammed output makes it difficult for our developers to see any console output that is actually important. How can I disable it?

(Failing that, a suggestion on how to get it outputting each line only once would be really welcome.)

like image 702
JosephH Avatar asked Jun 07 '17 17:06

JosephH


Video Answer


2 Answers

You can find this buried in the output:

<Notice> [Firebase/Analytics][I-ACS023008] To enable debug logging  set the following application argument: -FIRAnalyticsDebugEnabled 

Disabling is the opposite - set the argument: -noFIRAnalyticsDebugEnabled:

enter image description here

Additionally, you can control the default Firebase logging level with the setLoggerLevel method in FIRConfiguration. For example to disable all Firebase logging:

  [[FIRConfiguration sharedInstance] setLoggerLevel:FIRLoggerLevelMin];   [FIRApp configure]; 

or in Swift:

FirebaseConfiguration.shared.setLoggerLevel(FirebaseLoggerLevel.min) FirebaseApp.configure() 

More details in the FIRLogger implementation here

like image 65
Paul Beusterien Avatar answered Sep 20 '22 01:09

Paul Beusterien


To the best of my knowledge, these two lines:

[[FIRConfiguration sharedInstance] setLoggerLevel:FIRLoggerLevelMin]; [[FIRAnalyticsConfiguration sharedInstance] setAnalyticsCollectionEnabled:NO]; 

placed very early in the app delegate's didFinishLaunchingWithOptions: will completely disable FireBase analytics, including stopping all the console output.

I've also since discovered that the Google/SignIn cocoapod is deprecated - the recommended one to use is GoogleSignIn (ie. no '/'). If you use GoogleSignIn, then this doesn't have a dependency on Firebase Analytics, so the original problem goes away. Now I have Google Drive support in my app and don't have Firebase Analytics!

like image 40
JosephH Avatar answered Sep 21 '22 01:09

JosephH