Java Code Examples for com.facebook.FacebookSdk#isLoggingBehaviorEnabled()
The following examples show how to use
com.facebook.FacebookSdk#isLoggingBehaviorEnabled() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Logger.java From kognitivo with Apache License 2.0 | 5 votes |
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); } }
Example 2
Source File: Logger.java From kognitivo with Apache License 2.0 | 5 votes |
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(); } } }
Example 3
Source File: Logger.java From kognitivo with Apache License 2.0 | 4 votes |
public synchronized static void registerAccessToken(String accessToken) { if (FacebookSdk.isLoggingBehaviorEnabled(LoggingBehavior.INCLUDE_ACCESS_TOKENS) == false) { registerStringToReplace(accessToken, "ACCESS_TOKEN_REMOVED"); } }
Example 4
Source File: Logger.java From kognitivo with Apache License 2.0 | 4 votes |
public static void log(LoggingBehavior behavior, String tag, String format, Object... args) { if (FacebookSdk.isLoggingBehaviorEnabled(behavior)) { String string = String.format(format, args); log(behavior, Log.DEBUG, tag, string); } }
Example 5
Source File: Logger.java From kognitivo with Apache License 2.0 | 4 votes |
private boolean shouldLog() { return FacebookSdk.isLoggingBehaviorEnabled(behavior); }
Example 6
Source File: AppEventsLogger.java From kognitivo with Apache License 2.0 | 4 votes |
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; } } }