Skip to content

Commit

Permalink
wasm gc: fix support for java.util.logging
Browse files Browse the repository at this point in the history
Fix #964
  • Loading branch information
konsoletyper committed Oct 25, 2024
1 parent 2e08640 commit 47c136c
Showing 1 changed file with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.teavm.classlib.java.util.THashMap;
import org.teavm.classlib.java.util.TMap;
import org.teavm.jso.JSBody;
import org.teavm.jso.impl.JS;

public class TLogger {
public static final String GLOBAL_LOGGER_NAME = "global";
Expand Down Expand Up @@ -70,11 +71,23 @@ public void log(TLogRecord record) {
}
} else {
if (record.getLevel().intValue() >= TLevel.SEVERE.intValue()) {
error(message);
if (PlatformDetector.isWebAssemblyGC()) {
JS.invoke(JS.global("console"), JS.wrap("error"), JS.wrap(message));
} else {
error(message);
}
} else if (record.getLevel().intValue() >= TLevel.WARNING.intValue()) {
warn(message);
if (PlatformDetector.isWebAssemblyGC()) {
JS.invoke(JS.global("console"), JS.wrap("warn"), JS.wrap(message));
} else {
warn(message);
}
} else {
infoImpl(message);
if (PlatformDetector.isWebAssemblyGC()) {
JS.invoke(JS.global("console"), JS.wrap("info"), JS.wrap(message));
} else {
infoImpl(message);
}
}
}
}
Expand Down

0 comments on commit 47c136c

Please sign in to comment.