@Override protected void processError(FacebookRequestError error) { Logger.log(LoggingBehavior.REQUESTS, TAG, "Error fetching like status for page id '%s': %s", this.pageId, error); logAppEventForError("get_page_like", error); }
public void appendKeyValue(String key, Object value) { append(" %s:\t%s\n", key, value); }
public void log() { logString(contents.toString()); contents = new StringBuilder(); }
HttpURLConnection connection ) throws IOException, JSONException { Logger logger = new Logger(LoggingBehavior.REQUESTS, "Request"); logger.append("Request:\n"); logger.appendKeyValue("Id", requests.getId()); logger.appendKeyValue("URL", url); logger.appendKeyValue("Method", connection.getRequestMethod()); logger.appendKeyValue("User-Agent", connection.getRequestProperty("User-Agent")); logger.appendKeyValue("Content-Type", connection.getRequestProperty("Content-Type")); logger.log(); return; logger.log();
public void append(StringBuilder stringBuilder) { if (shouldLog()) { contents.append(stringBuilder); } }
public String getContents() { return replaceStrings(contents.toString()); }
public void writeBytes(String key, byte[] bytes) throws IOException { writeContentDisposition(key, key, "content/unknown"); this.outputStream.write(bytes); writeLine(""); writeRecordBoundary(); if (logger != null) { logger.appendKeyValue( " " + key, String.format(Locale.ROOT, "<Data: %d>", bytes.length)); } }
public synchronized static void registerAccessToken(String accessToken) { if (FacebookSdk.isLoggingBehaviorEnabled(LoggingBehavior.INCLUDE_ACCESS_TOKENS) == false) { registerStringToReplace(accessToken, "ACCESS_TOKEN_REMOVED"); } }
if (this.accessToken != null) { String token = this.accessToken.getToken(); Logger.registerAccessToken(token);
final static void serializeToUrlConnection(RequestBatch requests, HttpURLConnection connection) throws IOException, JSONException { Logger logger = new Logger(LoggingBehavior.REQUESTS, "Request"); logger.append("Request:\n"); logger.appendKeyValue("Id", requests.getId()); logger.appendKeyValue("URL", url); logger.appendKeyValue("Method", connection.getRequestMethod()); logger.appendKeyValue("User-Agent", connection.getRequestProperty("User-Agent")); logger.appendKeyValue("Content-Type", connection.getRequestProperty("Content-Type")); logger.log(); return; logger.log();
public void append(String string) { if (shouldLog()) { contents.append(string); } }
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(); } } }
public void writeBitmap(String key, Bitmap bitmap) throws IOException { writeContentDisposition(key, key, "image/png"); // Note: quality parameter is ignored for PNG bitmap.compress(Bitmap.CompressFormat.PNG, 100, outputStream); writeLine(""); writeRecordBoundary(); if (logger != null) { logger.appendKeyValue(" " + key, "<Image>"); } }
public synchronized static void registerAccessToken(String accessToken) { if (Settings.isLoggingBehaviorEnabled(LoggingBehavior.INCLUDE_ACCESS_TOKENS) == false) { registerStringToReplace(accessToken, "ACCESS_TOKEN_REMOVED"); } }
private void addCommonParameters() { if (this.accessToken != null) { if (!this.parameters.containsKey(ACCESS_TOKEN_PARAM)) { String token = accessToken.getToken(); Logger.registerAccessToken(token); this.parameters.putString(ACCESS_TOKEN_PARAM, token); } } else if (!skipClientToken && !this.parameters.containsKey(ACCESS_TOKEN_PARAM)) { String appID = FacebookSdk.getApplicationId(); String clientToken = FacebookSdk.getClientToken(); if (!Utility.isNullOrEmpty(appID) && !Utility.isNullOrEmpty(clientToken)) { String accessToken = appID + "|" + clientToken; this.parameters.putString(ACCESS_TOKEN_PARAM, accessToken); } else { Utility.logd(TAG, "Warning: Request without access token missing application ID or" + " client token."); } } this.parameters.putString(SDK_PARAM, SDK_ANDROID); this.parameters.putString(FORMAT_PARAM, FORMAT_JSON); if (FacebookSdk.isLoggingBehaviorEnabled(LoggingBehavior.GRAPH_API_DEBUG_INFO)) { this.parameters.putString(DEBUG_PARAM, DEBUG_SEVERITY_INFO); } else if (FacebookSdk.isLoggingBehaviorEnabled(LoggingBehavior.GRAPH_API_DEBUG_WARNING)) { this.parameters.putString(DEBUG_PARAM, DEBUG_SEVERITY_WARNING); } }
@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); } }
public void append(String format, Object... args) { if (shouldLog()) { contents.append(String.format(format, args)); } }
public String getContents() { return replaceStrings(contents.toString()); }
public void writeString(String key, String value) throws IOException { writeContentDisposition(key, null, null); writeLine("%s", value); writeRecordBoundary(); if (logger != null) { logger.appendKeyValue(" " + key, value); } }