Skip to content

Commit

Permalink
Logger can never be null now, right?
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Kirby committed Jan 12, 2019
1 parent a297cad commit 81cb2d2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/main/java/hunternif/mc/atlas/CommonProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public MinecraftServer getServer() {
}

public void preInit(FMLPreInitializationEvent event) {
Log.setModLog();
configDir = new File(event.getModConfigurationDirectory(), "antiqueatlas");
configDir.mkdir();
extTileIdMap = ExtTileIdMap.instance();
Expand Down
12 changes: 3 additions & 9 deletions src/main/java/hunternif/mc/atlas/util/Log.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,13 @@

/**
* A simple logging helper that is not directly dependent on any mod classes.
* Make sure to call {@link #setModLog()} at the start of the mod's pre-init.
* @author Hunternif
*/
public class Log {
private static Logger modLog;

public static void setModLog() {
Log.modLog = LogManager.getLogger(AntiqueAtlasMod.ID);
}

private static final Logger LOGGER = LogManager.getLogger(AntiqueAtlasMod.ID);

private static void log(Level level, Throwable ex, String msg, Object... data) {
if (modLog == null) return;
modLog.log(level, () -> data == null ? msg : String.format(msg, data), ex);
LOGGER.log(level, () -> data == null ? msg : String.format(msg, data), ex);
}

public static void debug(String msg, Object ... data) {
Expand Down
1 change: 0 additions & 1 deletion src/test/java/hunternif/mc/atlas/TestNBT.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ public void init() {

@Test
public void testTileGroupBounds() {
Log.setModLog();
tg.setTile(15,15, new Tile(1));
tg.setTile(32,32, new Tile(1));
assertEquals(null, tg.getTile(15, 15));
Expand Down

0 comments on commit 81cb2d2

Please sign in to comment.