本文整理匯總了Java中com.facebook.internal.Logger類的典型用法代碼示例。如果您正苦於以下問題:Java Logger類的具體用法?Java Logger怎麽用?Java Logger使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Logger類屬於com.facebook.internal包,在下文中一共展示了Logger類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: processError
import com.facebook.internal.Logger; //導入依賴的package包/類
@Override
protected void processError(FacebookRequestError error) {
int errorCode = error.getErrorCode();
if (errorCode == ERROR_CODE_OBJECT_ALREADY_LIKED) {
// This isn't an error for us. Client was just out of sync with server
// This will prevent us from showing the dialog for this.
// However, there is no unliketoken. So a subsequent unlike WILL show the dialog
this.error = null;
} else {
Logger.log(LoggingBehavior.REQUESTS,
TAG,
"Error liking object '%s' with type '%s' : %s",
objectId,
objectType,
error);
logAppEventForError("publish_like", error);
}
}
示例2: onSuspend
import com.facebook.internal.Logger; //導入依賴的package包/類
void onSuspend(AppEventsLogger logger, long eventTime) {
if (!isAppActive) {
Logger.log(LoggingBehavior.APP_EVENTS, TAG, "Suspend for inactive app");
return;
}
long now = eventTime;
long delta = (now - lastResumeTime);
if (delta < 0) {
Logger.log(LoggingBehavior.APP_EVENTS, TAG, "Clock skew detected");
delta = 0;
}
millisecondsSpentInSession += delta;
lastSuspendTime = now;
isAppActive = false;
}
示例3: createResponsesFromString
import com.facebook.internal.Logger; //導入依賴的package包/類
static List<GraphResponse> createResponsesFromString(
String responseString,
HttpURLConnection connection,
GraphRequestBatch requests
) throws FacebookException, JSONException, IOException {
JSONTokener tokener = new JSONTokener(responseString);
Object resultObject = tokener.nextValue();
List<GraphResponse> responses = createResponsesFromObject(
connection,
requests,
resultObject);
Logger.log(
LoggingBehavior.REQUESTS,
RESPONSE_LOG_TAG,
"Response\n Id: %s\n Size: %d\n Responses:\n%s\n",
requests.getId(),
responseString.length(),
responses);
return responses;
}
示例4: load
import com.facebook.internal.Logger; //導入依賴的package包/類
public Bundle load() {
Bundle settings = new Bundle();
Map<String, ?> allCachedEntries = cache.getAll();
for (String key : allCachedEntries.keySet()) {
try {
deserializeKey(key, settings);
} catch (JSONException e) {
// Error in the cache. So consider it corrupted and return null
Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG,
"Error reading cached value for key: '" + key + "' -- " + e);
return null;
}
}
return settings;
}
示例5: save
import com.facebook.internal.Logger; //導入依賴的package包/類
public void save(Bundle bundle) {
Validate.notNull(bundle, "bundle");
SharedPreferences.Editor editor = cache.edit();
for (String key : bundle.keySet()) {
try {
serializeKey(key, bundle, editor);
} catch (JSONException e) {
// Error in the bundle. Don't store a partial cache.
Logger.log(
LoggingBehavior.CACHE,
Log.WARN,
TAG,
"Error processing value for key: '" + key + "' -- " + e);
// Bypass the commit and just return. This cancels the entire edit transaction
return;
}
}
editor.apply();
}
示例6: load
import com.facebook.internal.Logger; //導入依賴的package包/類
/**
* Returns a Bundle that contains the information stored in this cache
*
* @return A Bundle with the information contained in this cache
*/
public Bundle load() {
Bundle settings = new Bundle();
Map<String, ?> allCachedEntries = cache.getAll();
for (String key : allCachedEntries.keySet()) {
try {
deserializeKey(key, settings);
} catch (JSONException e) {
// Error in the cache. So consider it corrupted and return null
Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG,
"Error reading cached value for key: '" + key + "' -- " + e);
return null;
}
}
return settings;
}
開發者ID:MobileDev418,項目名稱:AndroidBackendlessChat,代碼行數:24,代碼來源:SharedPreferencesTokenCachingStrategy.java
示例7: save
import com.facebook.internal.Logger; //導入依賴的package包/類
/**
* Persists all supported data types present in the passed in Bundle, to the
* cache
*
* @param bundle
* The Bundle containing information to be cached
*/
public void save(Bundle bundle) {
Validate.notNull(bundle, "bundle");
SharedPreferences.Editor editor = cache.edit();
for (String key : bundle.keySet()) {
try {
serializeKey(key, bundle, editor);
} catch (JSONException e) {
// Error in the bundle. Don't store a partial cache.
Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "Error processing value for key: '" + key + "' -- " + e);
// Bypass the commit and just return. This cancels the entire edit transaction
return;
}
}
boolean successfulCommit = editor.commit();
if (!successfulCommit) {
Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "SharedPreferences.Editor.commit() was not successful");
}
}
開發者ID:MobileDev418,項目名稱:AndroidBackendlessChat,代碼行數:30,代碼來源:SharedPreferencesTokenCachingStrategy.java
示例8: processResponse
import com.facebook.internal.Logger; //導入依賴的package包/類
private void processResponse(ImageResponse response) {
// First check if the response is for the right request. We may have:
// 1. Sent a new request, thus super-ceding this one.
// 2. Detached this view, in which case the response should be discarded.
if (response.getRequest() == lastRequest) {
lastRequest = null;
Bitmap responseImage = response.getBitmap();
Exception error = response.getError();
if (error != null) {
OnErrorListener listener = onErrorListener;
if (listener != null) {
listener.onError(new FacebookException(
"Error in downloading profile picture for profileId: " + getProfileId(), error));
} else {
Logger.log(LoggingBehavior.REQUESTS, Log.ERROR, TAG, error.toString());
}
} else if (responseImage != null) {
setImageBitmap(responseImage);
if (response.isCachedRedirect()) {
sendImageRequest(false);
}
}
}
}
示例9: save
import com.facebook.internal.Logger; //導入依賴的package包/類
/**
* Persists all supported data types present in the passed in Bundle, to the
* cache
*
* @param bundle
* The Bundle containing information to be cached
*/
public void save(Bundle bundle) {
Validate.notNull(bundle, "bundle");
SharedPreferences.Editor editor = cache.edit();
for (String key : bundle.keySet()) {
try {
serializeKey(key, bundle, editor);
} catch (JSONException e) {
// Error in the bundle. Don't store a partial cache.
Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "Error processing value for key: '" + key + "' -- " + e);
// Bypass the commit and just return. This cancels the entire edit transaction
return;
}
}
editor.apply();
}
示例10: saveAppSessionInformation
import com.facebook.internal.Logger; //導入依賴的package包/類
static void saveAppSessionInformation(Context context) {
ObjectOutputStream oos = null;
synchronized (staticLock) {
if (hasChanges) {
try {
oos = new ObjectOutputStream(
new BufferedOutputStream(
context.openFileOutput(
PERSISTED_SESSION_INFO_FILENAME,
Context.MODE_PRIVATE)
)
);
oos.writeObject(appSessionInfoMap);
hasChanges = false;
Logger.log(LoggingBehavior.APP_EVENTS, "AppEvents", "App session info saved");
} catch (Exception e) {
Log.d(TAG, "Got unexpected exception: " + e.toString());
} finally {
Utility.closeQuietly(oos);
}
}
}
}