如何在启动应用时停止Firebase记录状态更新

Tek*_*ock 79 iphone ios firebase

每当我启动FireBase应用程序时,它都会记录各种Firebase功能的状态.现在这是记录的内容:

Configuring the default app.

<FIRAnalytics/INFO> Firebase Analytics v.3200000 started

<FIRAnalytics/INFO> To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see ...)

<FIRAnalytics/INFO> Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist

<FIRInstanceID/WARNING> FIRInstanceID AppDelegate proxy enabled, will swizzle app delegate remote notification handlers. To disable add "FirebaseAppDelegateProxyEnabled" to your Info.plist and set it to NO

<FIRAnalytics/INFO> Firebase Analytics enabled
Run Code Online (Sandbox Code Playgroud)

我查看了pod并且没有找到任何打印语句,那么我怎样才能阻止这些超时记录我运行应用程序?

Ian*_*ber 93

您可以使用该标志禁用调试日志记录-FIRDebugDisabled.

您可以将其添加到您的方案中:

  1. 选择Scheme工具栏
  2. 编辑方案
  3. 选择运行
  4. 单击"参数"并添加 -FIRDebugDisabled

  • `-noFIRAnalyticsDebugEnabled`被重命名为`-FIRDebugDisabled`.其他步骤是相同的​​. (17认同)
  • 不太好(这可能不会被添加到代码存储库等,因此将导致不同的代码,具体取决于构建方法(想想运行/存档)).默认情况下,发布版本应该有日志OFF ...恕我直言 (3认同)
  • 啊,我和工程师们一起检查过——不管怎样,这些消息都会被记录下来。有了旗帜,这就是你应该看到的。 (2认同)
  • 这会对 Firebase 分析的调试模式产生可怕的副作用 (2认同)

Rap*_*ira 47

FirebaseConfiguration.shared.setLoggerLevel(.min)之前添加FirebaseApp.configure()以实现最少量的日志记录.

func setupFirebase() {
  FirebaseConfiguration.shared.setLoggerLevel(.min)
  FirebaseApp.configure()
}
Run Code Online (Sandbox Code Playgroud)

  • 代码已更新为FIRConfiguration.sharedInstance().setLoggerLevel(.min) (3认同)
  • 对于 Objective-c 中的任何人:`[[FIRConfiguration shareInstance] setLoggerLevel:FIRLoggerLevelWarning]; [FIRApp 配置];` (2认同)

Suj*_*U N 13

默认情况下,Firebase会记录信息,错误和警告.
所以你可以设置你需要的记录器级别.
如果设置为.Error,则只有在出现错误时才会获得min log.

FirebaseApp.configure()之前的setLoggerLevel如下所示

在Swift 2.3和Firebase 4中

 FirebaseConfiguration.sharedInstance().setLoggerLevel(.Error)
 FirebaseApp.configure()
Run Code Online (Sandbox Code Playgroud)

在Swift 3和Firebase 4中

 FirebaseConfiguration.shared.setLoggerLevel(.min)
 FirebaseApp.configure()
Run Code Online (Sandbox Code Playgroud)


Jor*_*ego 8

在我的情况下,从Firebase隐藏额外的控制台日志块我做了以下事情:

  1. 导航到产品 - >方案 - >编辑方案.
  2. 在"环境变量"部分的"参数"选项卡下,添加OS_ACTIVITY_MODE = disable

在此输入图像描述

  • 如果您需要,只需取消选中该框即可.
  • 禁用OS_ACTIVITY_MODE有时也会禁用所有异常的日志

  • 这与firebase无关 (3认同)
  • 停止告诉人们禁用所有日志记录。 (2认同)

Cha*_*har 6

FIRConfiguration.sharedInstance().setLoggerLevel(.min)
FIRApp.configure()
Run Code Online (Sandbox Code Playgroud)

在Swift 4中

  • FB 5.14 中的`FirebaseConfiguration.shared.setLoggerLevel(.min)` (2认同)

Ond*_*čík 5

Swift 4 Firebase 4.10

在您的AppDelegate.swift中设置记录器级别

FirebaseConfiguration().setLoggerLevel(FirebaseLoggerLevel.min)
Run Code Online (Sandbox Code Playgroud)

这是完整的代码:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    FirebaseConfiguration().setLoggerLevel(FirebaseLoggerLevel.min)
    FirebaseApp.configure()
    return true
}
Run Code Online (Sandbox Code Playgroud)