-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
433aa00
commit cfe7418
Showing
8 changed files
with
103 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
common/src/main/java/info/mmpa/pipeblocker/logger/PipeBlockerJavaLogger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package info.mmpa.pipeblocker.logger; | ||
|
||
import java.lang.reflect.Method; | ||
import java.util.logging.Logger; | ||
|
||
public class PipeBlockerJavaLogger implements PipeBlockerLogger { | ||
private final Logger logger = Logger.getLogger("PipeBlocker"); | ||
|
||
public PipeBlockerJavaLogger() { | ||
// Legacy FML logger injection | ||
try { | ||
Class<?> fmlLog = Class.forName("cpw.mods.fml.common.FMLLog"); | ||
Method getLogger = fmlLog.getMethod("getLogger"); | ||
getLogger.setAccessible(true); | ||
logger.setParent((Logger) getLogger.invoke(null)); | ||
} catch (Throwable ignored) { | ||
} | ||
} | ||
|
||
@Override | ||
public void info(String msg) { | ||
logger.info(msg); | ||
} | ||
|
||
@Override | ||
public void error(String msg) { | ||
logger.severe(msg); | ||
} | ||
|
||
@Override | ||
public void debug(String msg) { | ||
logger.finest(msg); | ||
} | ||
|
||
@Override | ||
public void warn(String msg) { | ||
logger.warning(msg); | ||
} | ||
|
||
@Override | ||
public void fatal(String msg) { | ||
logger.severe(msg); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 3 additions & 6 deletions
9
forge17_112/src/main/java/info/mmpa/pipeblocker/PipeBlockerMod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,17 @@ | ||
package info.mmpa.pipeblocker; | ||
|
||
import info.mmpa.pipeblocker.logger.PipeBlockerLogger; | ||
import net.minecraftforge.fml.common.Mod; | ||
import net.minecraftforge.fml.common.event.FMLInitializationEvent; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
import java.util.*; | ||
|
||
@Mod(modid = "pipeblocker", name = "PipeBlocker", version = Tags.VERSION, acceptableRemoteVersions = "*") | ||
public class PipeBlockerMod { | ||
|
||
public static final Logger LOGGER = LogManager.getLogger("PipeBlocker"); | ||
public static final PipeBlockerLogger LOGGER = PipeBlockerLogger.detectLogger(); | ||
|
||
@Mod.EventHandler | ||
@SuppressWarnings("unused") | ||
public void init(FMLInitializationEvent ev) { | ||
PipeBlocker.useLog4j(); | ||
PipeBlocker.chooseBestLogger(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
javaagent/src/main/java/info/mmpa/pipeblocker/PipeBlockerAgent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters