Skip to content

Commit

Permalink
Misc logging tidy
Browse files Browse the repository at this point in the history
- Removed leftover debug System.out.println in ASM
- Removed unused logger from Share
- Routed ResourceUtil errors into FPLog instead of System.out/System.err
  • Loading branch information
basdxz committed Jun 15, 2024
1 parent 2f2b1ed commit c48663f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
6 changes: 0 additions & 6 deletions src/main/java/com/falsepattern/lib/internal/Share.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class Share {
public static final Logger LOG = LogManager.getLogger(Tags.MODNAME);

public static final boolean DEV_ENV;

static {
Expand All @@ -49,8 +47,4 @@ public final class Share {
}

public static boolean EARLY_INIT_DONE = false;

public static void deprecatedWarning(Throwable stacktrace) {
LOG.warn("DEPRECATED API CALLED!", stacktrace);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public static void init() {
}
for (int i = 0; i < transformers.size(); i++) {
val transformer = transformers.get(i);
System.out.println(transformer.getClass().getName());
if (transformer.getClass().getName().equals("optifine.OptiFineClassTransformer")) {
FPLog.LOG.info("Attaching OptiFine ASM transformer hooks");
transformers.set(i, new WrappedOptiFineClassTransformer(transformer));
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/falsepattern/lib/util/ResourceUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
package com.falsepattern.lib.util;

import com.falsepattern.lib.StableAPI;
import com.falsepattern.lib.internal.FPLog;
import lombok.experimental.UtilityClass;
import lombok.val;

Expand Down Expand Up @@ -125,15 +126,14 @@ public static InputStream getResourceFromJar(String resourcePath, Class<?> refer
URL resource = new URL("jar:" + file.substring(0, id) + "!" + resourcePath);
return resource.openStream();
} catch (IOException e) {
System.err.println("Failed to load resource " + resourcePath + " from jar " + file.substring(0, id));
e.printStackTrace();
FPLog.LOG.error("Failed to load resource " + resourcePath + " from jar " + file.substring(0, id), e);
}
}
//Fallback logic
System.out.println("Using fallback resource loading logic for "
+ resourcePath
+ " with reference to "
+ referenceClass.getName());
FPLog.LOG.warn("Using fallback resource loading logic for "
+ resourcePath
+ " with reference to "
+ referenceClass.getName());
return referenceClass.getResourceAsStream(resourcePath);
}

Expand Down

0 comments on commit c48663f

Please sign in to comment.