Skip to content

Commit

Permalink
fix(android): Use Logger class instead of Log in CapacitorCookieManag…
Browse files Browse the repository at this point in the history
…er (#6923)
  • Loading branch information
jcesarmobile authored and markemer committed Oct 23, 2023
1 parent 81da1bc commit b528139
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.getcapacitor.plugin;

import android.util.Log;
import com.getcapacitor.Bridge;
import com.getcapacitor.Logger;
import java.net.CookieManager;
import java.net.CookiePolicy;
import java.net.CookieStore;
Expand Down Expand Up @@ -64,7 +64,7 @@ public String getSanitizedDomain(String url) throws URISyntaxException {
try {
new URI(url);
} catch (Exception error) {
Log.e(TAG, "Failed to get sanitized URL.", error);
Logger.error(TAG, "Failed to get sanitized URL.", error);
throw error;
}
}
Expand All @@ -85,10 +85,10 @@ private String getDomainFromCookieString(String cookie) throws URISyntaxExceptio
public String getCookieString(String url) {
try {
url = getSanitizedDomain(url);
Log.i(TAG, "Getting cookies at: '" + url + "'");
Logger.info(TAG, "Getting cookies at: '" + url + "'");
return webkitCookieManager.getCookie(url);
} catch (Exception error) {
Log.e(TAG, "Failed to get cookies at the given URL.", error);
Logger.error(TAG, "Failed to get cookies at the given URL.", error);
}

return null;
Expand Down Expand Up @@ -145,11 +145,11 @@ public HttpCookie[] getCookies(String url) {
public void setCookie(String url, String value) {
try {
url = getSanitizedDomain(url);
Log.i(TAG, "Setting cookie '" + value + "' at: '" + url + "'");
Logger.info(TAG, "Setting cookie '" + value + "' at: '" + url + "'");
webkitCookieManager.setCookie(url, value);
flush();
} catch (Exception error) {
Log.e(TAG, "Failed to set cookie.", error);
Logger.error(TAG, "Failed to set cookie.", error);
}
}

Expand Down

0 comments on commit b528139

Please sign in to comment.