Program Tip

앱이 시작될 때 Firebase 상태 업데이트 로깅을 중지하는 방법

programtip 2020. 10. 18. 19:00
반응형

앱이 시작될 때 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

포드를 살펴 보았지만 인쇄 문을 찾지 못했기 때문에이 앱을 실행하여 초과 시간에 기록되지 않도록 어떻게해야합니까?


플래그를 사용하여 디버그 로깅을 비활성화 할 수 있습니다 -FIRDebugDisabled.

구성표에 추가 할 수 있습니다 .

  1. 구성표 선택 도구 모음
  2. 구성표 편집
  3. 실행 선택
  4. 인수를 클릭하고 추가 -FIRDebugDisabled

최소한의 로깅을 달성하려면 FirebaseConfiguration.shared.setLoggerLevel(.min)전에 추가하십시오 FirebaseApp.configure().

func setupFirebase() {
  FirebaseConfiguration.shared.setLoggerLevel(.min)
  FirebaseApp.configure()
}

기본적으로 Firebase는 정보, 오류 및 경고를 기록합니다.
따라서 필요한 로거 레벨을 설정할 수 있습니다.
.Error를 설정하면 오류가 발생한 경우에만 최소 로그가 표시됩니다.

아래와 같이 FirebaseApp.configure () 전에 setLoggerLevel

Swift 2.3 및 Firebase 4

 FirebaseConfiguration.sharedInstance().setLoggerLevel(.Error)
 FirebaseApp.configure()

Swift 3 및 Firebase 4

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

필자의 경우 Firebase에서 추가 콘솔 로그 청크를 숨기려면 다음을 수행했습니다.

  1. Product-> Scheme-> Edit Scheme으로 이동합니다.
  2. 환경 변수 섹션의 인수 탭에서 OS_ACTIVITY_MODE = disable을 추가하십시오.

여기에 이미지 설명 입력

  • 필요한 경우 상자를 선택 취소하면됩니다.
  • OS_ACTIVITY_MODE를 비활성화 하면 때때로 모든 예외에 대한 로그도 비활성화 됩니다.

Edit 1: As @jesus-adolfo-rodriguez said, this is related to Xcode. So, if you don’t want OSLog on the Xcode console, put OS_ACTIVITY_MODE Environment variable to “disable” in your scheme.


Edit 2:

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

More details in the FIRConfiguration implementation here


Swift 4 Firebase 4.10

Set logger level in your AppDelegate.swift

FirebaseConfiguration().setLoggerLevel(FirebaseLoggerLevel.min)

Here is full code:

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

FIRConfiguration.sharedInstance().setLoggerLevel(.min)
FIRApp.configure()

In Swift 4


By default Firebase Analytics will only log 4 INFO lines in production + errors/warnings. That should be very little output if things work correctly. Adding -noFIRAnalyticsDebugEnabled will only disable DEBUG level logs and ERROR/WARN are always logged. If you see any warnings or errors you probably need to do something to resolve the cause. Some things will likely not work correctly if warnings/errors are logged. App that is correctly setup should not log errors/warnings.

Messages tagged with FIRInstanceID/* are logged by Firebase Notification and errors/warnings are always logged.


As djabi said, you cannot disable those logs if they are INFO, WARNING or ERROR.

I want to add to Nitin Gohel's answer since I can't comment: The flag FirebaseAppDelegateProxyEnabled is not for disabling logs. If you turn it off, you will lose the auto campaign tracking and you will need to add the methods from FIRAnalytics(AppDelegate) to handle URL and user activity yourself.


To add to Alex' answer, from https://firebase.google.com/docs/cloud-messaging/ios/client

FirebaseAppDelegateProxyEnabled is for swizzling your app delegate 's methods

FCM API는 APN 토큰을 FCM 등록 토큰에 매핑하고 다운 스트림 메시지 콜백 처리 중에 분석 데이터를 캡처하는 두 가지 주요 영역에서 메소드 재구성을 수행합니다. 스위 즐링을 사용하지 않으려는 개발자 는 앱의 Info.plist 파일에 FirebaseAppDelegateProxyEnabled 플래그를 추가하고 NO (부울 값)로 설정 하여 비활성화 할 수 있습니다 . 가이드의 관련 영역에서는 메서드 재구성이 활성화 된 경우와없는 경우 모두 코드 예제를 제공합니다.

참고 URL : https://stackoverflow.com/questions/37311089/how-to-stop-firebase-from-logging-status-updates-when-app-is-launched

반응형