當前位置: 首頁>>代碼示例>>Java>>正文


Java FacebookSdk.isLoggingBehaviorEnabled方法代碼示例

本文整理匯總了Java中com.facebook.FacebookSdk.isLoggingBehaviorEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java FacebookSdk.isLoggingBehaviorEnabled方法的具體用法?Java FacebookSdk.isLoggingBehaviorEnabled怎麽用?Java FacebookSdk.isLoggingBehaviorEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.facebook.FacebookSdk的用法示例。


在下文中一共展示了FacebookSdk.isLoggingBehaviorEnabled方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: log

import com.facebook.FacebookSdk; //導入方法依賴的package包/類
public static void log(
        LoggingBehavior behavior,
        int priority,
        String tag,
        String format,
        Object... args) {
    if (FacebookSdk.isLoggingBehaviorEnabled(behavior)) {
        String string = String.format(format, args);
        log(behavior, priority, tag, string);
    }
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:12,代碼來源:Logger.java

示例2: log

import com.facebook.FacebookSdk; //導入方法依賴的package包/類
public static void log(LoggingBehavior behavior, int priority, String tag, String string) {
    if (FacebookSdk.isLoggingBehaviorEnabled(behavior)) {
        string = replaceStrings(string);
        if (tag.startsWith(LOG_TAG_BASE) == false) {
            tag = LOG_TAG_BASE + tag;
        }
        Log.println(priority, tag, string);

        // Developer errors warrant special treatment by printing out a stack trace, to make
        // both more noticeable, and let the source of the problem be more easily pinpointed.
        if (behavior == LoggingBehavior.DEVELOPER_ERRORS) {
            (new Exception()).printStackTrace();
        }
    }
}
 
開發者ID:CE-KMITL-OOAD-2015,項目名稱:Move-Alarm_ORCA,代碼行數:16,代碼來源:Logger.java

示例3: registerAccessToken

import com.facebook.FacebookSdk; //導入方法依賴的package包/類
public synchronized static void registerAccessToken(String accessToken) {
    if (FacebookSdk.isLoggingBehaviorEnabled(LoggingBehavior.INCLUDE_ACCESS_TOKENS) == false) {
        registerStringToReplace(accessToken, "ACCESS_TOKEN_REMOVED");
    }
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:6,代碼來源:Logger.java

示例4: shouldLog

import com.facebook.FacebookSdk; //導入方法依賴的package包/類
private boolean shouldLog() {
    return FacebookSdk.isLoggingBehaviorEnabled(behavior);
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:4,代碼來源:Logger.java

示例5: handleResponse

import com.facebook.FacebookSdk; //導入方法依賴的package包/類
private static void handleResponse(
        AccessTokenAppIdPair accessTokenAppId,
        GraphRequest request,
        GraphResponse response,
        SessionEventsState sessionEventsState,
        FlushStatistics flushState) {
    FacebookRequestError error = response.getError();
    String resultDescription = "Success";

    FlushResult flushResult = FlushResult.SUCCESS;

    if (error != null) {
        final int NO_CONNECTIVITY_ERROR_CODE = -1;
        if (error.getErrorCode() == NO_CONNECTIVITY_ERROR_CODE) {
            resultDescription = "Failed: No Connectivity";
            flushResult = FlushResult.NO_CONNECTIVITY;
        } else {
            resultDescription = String.format("Failed:\n  Response: %s\n  Error %s",
                    response.toString(),
                    error.toString());
            flushResult = FlushResult.SERVER_ERROR;
        }
    }

    if (FacebookSdk.isLoggingBehaviorEnabled(LoggingBehavior.APP_EVENTS)) {
        String eventsJsonString = (String) request.getTag();
        String prettyPrintedEvents;

        try {
            JSONArray jsonArray = new JSONArray(eventsJsonString);
            prettyPrintedEvents = jsonArray.toString(2);
        } catch (JSONException exc) {
            prettyPrintedEvents = "<Can't encode events for debug logging>";
        }

        Logger.log(LoggingBehavior.APP_EVENTS, TAG,
                "Flush completed\nParams: %s\n  Result: %s\n  Events JSON: %s",
                request.getGraphObject().toString(),
                resultDescription,
                prettyPrintedEvents);
    }

    sessionEventsState.clearInFlightAndStats(error != null);

    if (flushResult == FlushResult.NO_CONNECTIVITY) {
        // We may call this for multiple requests in a batch, which is slightly inefficient
        // since in principle we could call it once for all failed requests, but the impact is
        // likely to be minimal. We don't call this for other server errors, because if an event
        // failed because it was malformed, etc., continually retrying it will cause subsequent
        // events to not be logged either.
        PersistedEvents.persistEvents(applicationContext, accessTokenAppId, sessionEventsState);
    }

    if (flushResult != FlushResult.SUCCESS) {
        // We assume that connectivity issues are more significant to report than server issues.
        if (flushState.result != FlushResult.NO_CONNECTIVITY) {
            flushState.result = flushResult;
        }
    }
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:61,代碼來源:AppEventsLogger.java


注:本文中的com.facebook.FacebookSdk.isLoggingBehaviorEnabled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。