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


Java Logger.log方法代碼示例

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


在下文中一共展示了Logger.log方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
    }
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:20,代碼來源:LikeActionController.java

示例2: 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,項目名稱:chat-sdk-android-push-firebase,代碼行數:30,代碼來源:SharedPreferencesTokenCachingStrategy.java

示例3: 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,項目名稱:chat-sdk-android-push-firebase,代碼行數:24,代碼來源:SharedPreferencesTokenCachingStrategy.java

示例4: 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;
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:23,代碼來源:GraphResponse.java

示例5: 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;
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:19,代碼來源:LegacyTokenHelper.java

示例6: 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();
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:23,代碼來源:LegacyTokenHelper.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;
        }
    }
    editor.apply();
}
 
開發者ID:dannegm,項目名稱:BrillaMXAndroid,代碼行數:26,代碼來源:SharedPreferencesTokenCachingStrategy.java

示例8: 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;
}
 
開發者ID:yudiandreanp,項目名稱:SocioBlood,代碼行數:17,代碼來源:FacebookTimeSpentData.java

示例9: 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);
            }
        }
    }
}
 
開發者ID:yeloapp,項目名稱:yelo-android,代碼行數:26,代碼來源:ProfilePictureView.java

示例10: createResponsesFromStream

import com.facebook.internal.Logger; //導入方法依賴的package包/類
static List<GraphResponse> createResponsesFromStream(
        InputStream stream,
        HttpURLConnection connection,
        GraphRequestBatch requests
) throws FacebookException, JSONException, IOException {

    String responseString = Utility.readStreamToString(stream);
    Logger.log(LoggingBehavior.INCLUDE_RAW_RESPONSES, RESPONSE_LOG_TAG,
            "Response (raw)\n  Size: %d\n  Response:\n%s\n", responseString.length(),
            responseString);

    return createResponsesFromString(responseString, connection, requests);
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:14,代碼來源:GraphResponse.java

示例11: logConversionPixel

import com.facebook.internal.Logger; //導入方法依賴的package包/類
/**
 * Deprecated. Please use {@link AppEventsLogger} instead.
 */
public void logConversionPixel(String pixelId, double valueOfPixel) {

    if (pixelId == null) {
        Logger.log(LoggingBehavior.DEVELOPER_ERRORS, "Insights", "pixelID cannot be null");
        return;
    }

    Bundle parameters = new Bundle();
    parameters.putString(EVENT_PARAMETER_PIXEL_ID, pixelId);
    parameters.putDouble(EVENT_PARAMETER_PIXEL_VALUE, valueOfPixel);

    appEventsLogger.logEvent(EVENT_NAME_LOG_CONVERSION_PIXEL, valueOfPixel, parameters);
    AppEventsLogger.eagerFlush();
}
 
開發者ID:MobileDev418,項目名稱:AndroidBackendlessChat,代碼行數:18,代碼來源:InsightsLogger.java

示例12: createResponsesFromStream

import com.facebook.internal.Logger; //導入方法依賴的package包/類
static List<Response> createResponsesFromStream(InputStream stream, HttpURLConnection connection,
        RequestBatch requests, boolean isFromCache) throws FacebookException, JSONException, IOException {

    String responseString = Utility.readStreamToString(stream);
    Logger.log(LoggingBehavior.INCLUDE_RAW_RESPONSES, RESPONSE_LOG_TAG,
            "Response (raw)\n  Size: %d\n  Response:\n%s\n", responseString.length(),
            responseString);

    return createResponsesFromString(responseString, connection, requests, isFromCache);
}
 
開發者ID:yeloapp,項目名稱:yelo-android,代碼行數:11,代碼來源:Response.java

示例13: processError

import com.facebook.internal.Logger; //導入方法依賴的package包/類
@Override
protected void processError(FacebookRequestError error) {
    Logger.log(LoggingBehavior.REQUESTS,
            TAG,
            "Error getting the FB id for object '%s' with type '%s' : %s",
            objectId,
            objectType,
            error);
}
 
開發者ID:yudiandreanp,項目名稱:SocioBlood,代碼行數:10,代碼來源:LikeActionController.java

示例14: restoreAppSessionInformation

import com.facebook.internal.Logger; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private static void restoreAppSessionInformation(Context context) {
    ObjectInputStream ois = null;

    synchronized (staticLock) {
        if (!isLoaded) {
            try {
                ois =
                        new ObjectInputStream(
                                context.openFileInput(PERSISTED_SESSION_INFO_FILENAME));
                appSessionInfoMap =
                        (HashMap<AccessTokenAppIdPair, FacebookTimeSpentData>) ois.readObject();
                Logger.log(
                        LoggingBehavior.APP_EVENTS,
                        "AppEvents",
                        "App session info loaded");
            } catch (FileNotFoundException fex) {
            } catch (Exception e) {
                Log.d(TAG, "Got unexpected exception: " + e.toString());
            } finally {
                Utility.closeQuietly(ois);
                context.deleteFile(PERSISTED_SESSION_INFO_FILENAME);
                if (appSessionInfoMap == null) {
                    appSessionInfoMap =
                            new HashMap<AccessTokenAppIdPair, FacebookTimeSpentData>();
                }
                // Regardless of the outcome of the load, the session information cache
                // is always deleted. Therefore, always treat the session information cache
                // as loaded
                isLoaded = true;
                hasChanges = false;
            }
        }
    }
}
 
開發者ID:dannegm,項目名稱:BrillaMXAndroid,代碼行數:36,代碼來源:AppEventsLogger.java

示例15: handleResponse

import com.facebook.internal.Logger; //導入方法依賴的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.internal.Logger.log方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。