本文整理汇总了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);
}
}
示例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();
}
}
}
示例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");
}
}
示例4: shouldLog
import com.facebook.FacebookSdk; //导入方法依赖的package包/类
private boolean shouldLog() {
return FacebookSdk.isLoggingBehaviorEnabled(behavior);
}
示例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;
}
}
}