Removed debug log configuration option, as it's no longer needed

This commit is contained in:
raoulvdberge
2017-05-29 19:49:39 +02:00
parent 7ae4ad3cf0
commit 81ee28955a
6 changed files with 3 additions and 75 deletions

View File

@@ -1,5 +1,8 @@
# Refined Storage Changelog
### 1.4.11
- Removed debug log configuration option, as it's no longer needed (raoulvdberge)
### 1.4.10
- Improved performance of network scanning (raoulvdberge)
- Fixed crash when attempting to get direction of a node (raoulvdberge)

View File

@@ -14,8 +14,6 @@ import java.util.List;
public final class RSConfig {
private Configuration config;
public boolean debugLog;
//region Energy
public int controllerBaseUsage;
public int cableUsage;
@@ -137,8 +135,6 @@ public final class RSConfig {
}
private void loadConfig() {
debugLog = config.getBoolean("debugLog", "misc", false, "Whether to debug log diagnostic info to a file");
//region Energy
controllerBaseUsage = config.getInt("controllerBase", ENERGY, 0, 0, Integer.MAX_VALUE, "The base energy used by the Controller");
cableUsage = config.getInt("cable", ENERGY, 0, 0, Integer.MAX_VALUE, "The energy used by Cables");

View File

@@ -58,13 +58,8 @@ import javax.annotation.Nullable;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.function.Function;
import java.util.logging.FileHandler;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
public final class RSUtils {
public static final ItemStack EMPTY_BUCKET = new ItemStack(Items.BUCKET);
@@ -593,33 +588,4 @@ public final class RSUtils {
vertexBuffer.pos(xCoord, yCoord + maskTop, zLevel).tex(uMin, vMin).endVertex();
tessellator.draw();
}
private static Logger debugLog = Logger.getLogger("Refined Storage");
private static FileHandler debugLogFileHandler;
public static void debugLog(String message) {
if (RS.INSTANCE.config.debugLog) {
if (debugLogFileHandler == null) {
try {
debugLogFileHandler = new FileHandler("refinedstorage_debuglog_" + new SimpleDateFormat("yyyy-MM-dd_HH_mm_ss").format(Calendar.getInstance().getTime()) + ".log");
} catch (Exception e) {
e.printStackTrace();
}
debugLogFileHandler.setFormatter(new Formatter() {
private SimpleDateFormat logFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@Override
public String format(LogRecord record) {
return "[" + logFormatter.format(new Date(record.getMillis())) + "] " + record.getMessage() + "\r\n";
}
});
debugLog.setUseParentHandlers(false);
debugLog.addHandler(debugLogFileHandler);
}
debugLog.info(message);
}
}
}

View File

@@ -1,6 +1,5 @@
package com.raoulvdberge.refinedstorage.apiimpl.network;
import com.raoulvdberge.refinedstorage.RSUtils;
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeFactory;
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeManager;
@@ -41,10 +40,6 @@ public class NetworkNodeManager extends WorldSavedData implements INetworkNodeMa
if (tag.hasKey(NBT_NODES)) {
this.nodesTag = tag.getTagList(NBT_NODES, Constants.NBT.TAG_COMPOUND);
this.canReadNodes = true;
RSUtils.debugLog("Stored nodes, waiting for actual read call...");
} else {
RSUtils.debugLog("Cannot read nodes, as there is no 'nodes' tag on this WorldSavedData");
}
this.nodes = newNodes;
@@ -56,12 +51,6 @@ public class NetworkNodeManager extends WorldSavedData implements INetworkNodeMa
nodes.clear();
int toRead = nodesTag.tagCount();
RSUtils.debugLog("Reading " + toRead + " nodes for dimension " + world.provider.getDimension() + "...");
int read = 0;
for (int i = 0; i < nodesTag.tagCount(); ++i) {
NBTTagCompound nodeTag = nodesTag.getCompoundTagAt(i);
@@ -73,27 +62,15 @@ public class NetworkNodeManager extends WorldSavedData implements INetworkNodeMa
if (factory != null) {
nodes.put(pos, factory.create(data, world, pos));
RSUtils.debugLog("Node at " + pos + " read... (" + (++read) + "/" + toRead + ")");
} else {
RSUtils.debugLog("Factory for node at " + pos + " is null (id: " + id + ")");
}
}
RSUtils.debugLog("Read " + read + " nodes out of " + toRead + " to read for dimension " + world.provider.getDimension());
}
}
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
int toWrite = all().size();
RSUtils.debugLog("Writing " + toWrite + " nodes...");
NBTTagList list = new NBTTagList();
int written = 0;
for (INetworkNode node : all()) {
NBTTagCompound nodeTag = new NBTTagCompound();
@@ -101,15 +78,11 @@ public class NetworkNodeManager extends WorldSavedData implements INetworkNodeMa
nodeTag.setLong(NBT_NODE_POS, node.getPos().toLong());
nodeTag.setTag(NBT_NODE_DATA, node.write(new NBTTagCompound()));
RSUtils.debugLog("Node at " + node.getPos() + " written... (" + (++written) + "/" + toWrite + ")");
list.appendTag(nodeTag);
}
tag.setTag(NBT_NODES, list);
RSUtils.debugLog("Wrote " + written + " nodes out of " + toWrite + " to write");
return tag;
}

View File

@@ -1,6 +1,5 @@
package com.raoulvdberge.refinedstorage.block;
import com.raoulvdberge.refinedstorage.RSUtils;
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeManager;
import com.raoulvdberge.refinedstorage.apiimpl.API;
@@ -40,8 +39,6 @@ public abstract class BlockNode extends BlockBase {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileNode) {
RSUtils.debugLog("Reading configuration from wrench at " + pos + "!");
((TileNode) tile).getNode().readConfiguration(stack.getTagCompound().getCompoundTag(NBT_REFINED_STORAGE_DATA));
((TileNode) tile).getNode().markDirty();
}
@@ -61,8 +58,6 @@ public abstract class BlockNode extends BlockBase {
removeTile(world, pos, state);
RSUtils.debugLog("Node block broken at " + pos + "!");
manager.removeNode(pos);
manager.markForSaving();

View File

@@ -1,6 +1,5 @@
package com.raoulvdberge.refinedstorage.tile;
import com.raoulvdberge.refinedstorage.RSUtils;
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeManager;
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeProxy;
import com.raoulvdberge.refinedstorage.api.util.IWrenchable;
@@ -107,8 +106,6 @@ public abstract class TileNode<N extends NetworkNode> extends TileBase implement
// @TODO: This is a hack to support previous broken versions that have no nodes for some tiles due to a bug
// This should actually be called in Block#onBlockAdded
if (node == null) {
RSUtils.debugLog("Creating node at " + pos);
manager.setNode(pos, node = createNode(world, pos));
manager.markForSaving();
}
@@ -134,8 +131,6 @@ public abstract class TileNode<N extends NetworkNode> extends TileBase implement
} else if (legacyTag.getSize() == 6 + 1 && hasMeta && hasForgeData && hasForgeCaps) {
// NO OP
} else {
RSUtils.debugLog("Reading legacy tag data at " + pos + "!");
node.read(legacyTag);
node.markDirty();