fun logEvent()

in facebook-core/src/main/java/com/facebook/appevents/AppEventsLoggerImpl.kt [309:351]


  fun logEvent(
      eventName: String?,
      valueToSum: Double?,
      parameters: Bundle?,
      isImplicitlyLogged: Boolean,
      currentSessionId: UUID?
  ) {
    if (eventName == null || eventName.isEmpty()) {
      return
    }

    // Kill events if kill-switch is enabled
    if (getGateKeeperForKey(APP_EVENTS_KILLSWITCH, FacebookSdk.getApplicationId(), false)) {
      log(
          LoggingBehavior.APP_EVENTS,
          "AppEvents",
          "KillSwitch is enabled and fail to log app event: %s",
          eventName)
      return
    }
    try {
      val event =
          AppEvent(
              contextName,
              eventName,
              valueToSum,
              parameters,
              isImplicitlyLogged,
              isInBackground(),
              currentSessionId)
      logEvent(event, accessTokenAppId)
    } catch (jsonException: JSONException) {
      // If any of the above failed, just consider this an illegal event.
      log(
          LoggingBehavior.APP_EVENTS,
          "AppEvents",
          "JSON encoding for app event failed: '%s'",
          jsonException.toString())
    } catch (e: FacebookException) {
      // If any of the above failed, just consider this an illegal event.
      log(LoggingBehavior.APP_EVENTS, "AppEvents", "Invalid app event: %s", e.toString())
    }
  }