本文整理汇总了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);
}
}
}
}