Files
Suwayomi-Server/AndroidCompat/src/main/java/android/util/Log.java
T
Constantin Piber a2fadbe513 Implement WebView via Playwright (#1434)
* Implement Android's Looper

Looper handles thread messaging. This is used by extensions when they
want to enqueue actions e.g. for sleeping while WebView does someting

* Stub WebView

* Continue stubbing ViewGroup for WebView

* Implement WebView via Playwright

* Lint

* Implement request interception

Supports Yidan

* Support WebChromeClient

For Bokugen

* Fix onPageStarted

* Make Playwright configurable

* Subscribe to config changes

* Fix exposing of functions

* Support data urls

* Looper: Fix infinite sleep

* Looper: Avoid killing the loop on exception

Just log it and continue

* Pump playwright's message queue periodically

https://playwright.dev/java/docs/multithreading#pagewaitfortimeout-vs-threadsleep

* Update server/src/main/kotlin/suwayomi/tachidesk/graphql/types/SettingsType.kt

Co-authored-by: Mitchell Syer <Syer10@users.noreply.github.com>

* Stub a KCef WebViewProvider

* Initial Kcef Webview implementation

Still buggy, on the second call it just seems to fall over

* Format, restructure to create browser on load

This is much more consistent, before we would sometimes see errors from
about:blank, which block the actual page

* Implement some small useful properties

* Move inline objects to class

* Handle requests in Kcef

* Move Playwright implementation

* Document Playwright settings, fix deprecated warnings

* Inject default user agent from NetworkHelper

* Move playwright to libs.versions.toml

* Lint

* Fix missing imports after lint

* Update server/src/main/kotlin/suwayomi/tachidesk/server/ServerSetup.kt

Co-authored-by: Mitchell Syer <Syer10@users.noreply.github.com>

* Fix default user agent set/get

Use System.getProperty instead of SystemProperties.get

* Configurable WebView provider implementation

* Simplify Playwright settings init

* Minor cleanup and improvements

* Remove playwright WebView impl

* Document WebView for Linux

---------

Co-authored-by: Mitchell Syer <Syer10@users.noreply.github.com>
2025-06-12 11:38:54 -04:00

140 lines
3.9 KiB
Java

//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package android.util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.PrintWriter;
import java.io.StringWriter;
public final class Log {
public static final int ASSERT = 7;
public static final int DEBUG = 3;
public static final int ERROR = 6;
public static final int INFO = 4;
public static final int VERBOSE = 2;
public static final int WARN = 5;
private static Logger logger = LoggerFactory.getLogger(Log.class);
public static int v(String tag, String msg) {
return log(VERBOSE, tag, msg);
}
public static int v(String tag, String msg, Throwable tr) {
return log(VERBOSE, tag, msg, tr);
}
public static int d(String tag, String msg) {
return log(DEBUG, tag, msg);
}
public static int d(String tag, String msg, Throwable tr) {
return log(DEBUG, tag, msg, tr);
}
public static int i(String tag, String msg) {
return log(INFO, tag, msg);
}
public static int i(String tag, String msg, Throwable tr) {
return log(INFO, tag, msg, tr);
}
public static int w(String tag, String msg) {
return log(WARN, tag, msg);
}
public static int w(String tag, String msg, Throwable tr) {
return log(WARN, tag, msg, tr);
}
public static boolean isLoggable(String var0, int var1) {
return true;
}
public static int w(String tag, Throwable tr) {
return log(WARN, tag, tr);
}
public static int e(String tag, String msg) {
return log(ERROR, tag, msg);
}
public static int e(String tag, String msg, Throwable tr) {
return log(ERROR, tag, msg, tr);
}
//Level?
public static int wtf(String tag, String msg) {
return log(ERROR, tag, msg);
}
public static int wtf(String tag, Throwable tr) {
return log(ERROR, tag, tr);
}
public static int wtf(String tag, String msg, Throwable tr) {
return log(ERROR, tag, msg, tr);
}
public static String getStackTraceString(Throwable tr) {
final StringWriter sw = new StringWriter();
final PrintWriter pw = new PrintWriter(sw, true);
tr.printStackTrace(pw);
return sw.getBuffer().toString();
}
public static int println(int priority, String tag, String msg) {
return log(priority, tag, msg);
}
private static int log(int level, String tag, String msg) {
logger.info(formatLog(level, tag, msg));
return tag.length() + msg.length(); //Not accurate, but never used anyways
}
private static int log(int level, String tag, Throwable t) {
return log(level, tag, "An exception occured!", t);
}
private static int log(int level, String tag, String msg, Throwable t) {
logger.info(formatLog(level, tag, msg), t);
return tag.length() + msg.length(); //Not accurate, but never used anyways
}
private static String formatLog(int level, String tag, String msg) {
StringBuilder first = new StringBuilder("[");
switch(level) {
case ASSERT:
first.append("ASSERT");
break;
case DEBUG:
first.append("DEBUG");
break;
case ERROR:
first.append("ERROR");
break;
case INFO:
first.append("INFO");
break;
case VERBOSE:
first.append("VERBOSE");
break;
case WARN:
first.append("WARN");
break;
default:
first.append("UNKNOWN");
break;
}
first.append("] ");
first.append(tag);
first.append(": ");
first.append(msg);
return first.toString();
}
}