Added Packet Logging

Added Crafting Logging
This commit is contained in:
AlgorithmX2 2014-07-04 17:43:53 -05:00
parent 8640ea7122
commit 14187dc799
5 changed files with 26 additions and 13 deletions

View file

@ -70,4 +70,13 @@ public class AELog
info( aeBaseTile.getClass().getName() + " @ " + xCoord + ", " + yCoord + ", " + zCoord );
}
}
public static void crafting(String format, Object... data)
{
if ( AEConfig.instance.isFeatureEnabled( AEFeature.CraftingLog ) )
{
log( Level.INFO, format, data );
}
}
}

View file

@ -52,7 +52,7 @@ public enum AEFeature
enableFacadeCrafting("Crafting"), inWorldSingularity("Crafting"), inWorldFluix("Crafting"), inWorldPurification("Crafting"), UpdateLogging("Misc", false),
AlphaPass("Rendering"), PaintBalls("Tools");
AlphaPass("Rendering"), PaintBalls("Tools"), PacketLogging("Misc", false), CraftingLog("Misc", false);
String Category;
boolean visible = true;

View file

@ -2,6 +2,9 @@ package appeng.core.sync;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.features.AEFeature;
import appeng.core.sync.network.INetworkInfo;
import appeng.core.sync.network.NetworkHandler;
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
@ -39,7 +42,12 @@ public abstract class AppEngPacket
if ( p.array().length > 2 * 1024 * 1024 ) // 2k walking room :)
throw new IllegalArgumentException( "Sorry AE2 made a " + p.array().length + " byte packet by accident!" );
return new FMLProxyPacket( p, NetworkHandler.instance.getChannel() );
FMLProxyPacket pp = new FMLProxyPacket( p, NetworkHandler.instance.getChannel() );
if ( AEConfig.instance.isFeatureEnabled( AEFeature.PacketLogging ) )
AELog.info( getClass().getName() + " : " + pp.payload().readableBytes() );
return pp;
}
}

View file

@ -158,10 +158,10 @@ public class CraftingJob implements Runnable, ICraftingJob
for (String s : opsAndMultiplier.keySet())
{
twoIntegers ti = opsAndMultiplier.get( s );
AELog.info( s + " * " + ti.times + " = " + (ti.perOp * ti.times) );
AELog.crafting( s + " * " + ti.times + " = " + (ti.perOp * ti.times) );
}
AELog.info( "------------- " + getByteTotal() + "b real" + timer.elapsed( TimeUnit.MILLISECONDS ) + "ms" );
AELog.crafting( "------------- " + getByteTotal() + "b real" + timer.elapsed( TimeUnit.MILLISECONDS ) + "ms" );
// if ( mode == Actionable.MODULATE )
// meci.moveItemsToStorage( storage );
}
@ -182,10 +182,10 @@ public class CraftingJob implements Runnable, ICraftingJob
for (String s : opsAndMultiplier.keySet())
{
twoIntegers ti = opsAndMultiplier.get( s );
AELog.info( s + " * " + ti.times + " = " + (ti.perOp * ti.times) );
AELog.crafting( s + " * " + ti.times + " = " + (ti.perOp * ti.times) );
}
AELog.info( "------------- " + getByteTotal() + "b simulate" + timer.elapsed( TimeUnit.MILLISECONDS ) + "ms" );
AELog.crafting( "------------- " + getByteTotal() + "b simulate" + timer.elapsed( TimeUnit.MILLISECONDS ) + "ms" );
}
catch (CraftBranchFailure e1)
{
@ -197,7 +197,7 @@ public class CraftingJob implements Runnable, ICraftingJob
}
catch (InterruptedException e1)
{
AELog.info( "Crafting calculation canceled." );
AELog.crafting( "Crafting calculation canceled." );
finish();
return;
}
@ -208,7 +208,7 @@ public class CraftingJob implements Runnable, ICraftingJob
}
catch (InterruptedException e1)
{
AELog.info( "Crafting calculation canceled." );
AELog.crafting( "Crafting calculation canceled." );
finish();
return;
}
@ -336,7 +336,7 @@ public class CraftingJob implements Runnable, ICraftingJob
private void log(String string)
{
// AELog.info( string );
// AELog.crafting( string );
}
public void addBytes(long crafts)

View file

@ -94,8 +94,6 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
if ( input == null )
return null;
// AELog.info( mode.toString() + "Inject: " + input.toString() );
if ( mode == Actionable.MODULATE )
{
if ( logInjections )
@ -112,8 +110,6 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
if ( request == null )
return null;
// AELog.info( mode.toString() + "Extract: " + request.toString() );
IAEItemStack list = localCache.findPrecise( request );
if ( list == null || list.getStackSize() == 0 )
return null;