Merge pull request #2010 from yueh/feature-logger-refactoring

Refactored the logging
This commit is contained in:
yueh
2015-12-27 12:53:01 +01:00
71 changed files with 537 additions and 213 deletions
@@ -413,7 +413,7 @@ public class ClientHelper extends ServerHelper
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
} }
@@ -410,7 +410,7 @@ public abstract class AEBaseGui extends GuiContainer
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
else if( slot instanceof SlotCraftingTerm ) else if( slot instanceof SlotCraftingTerm )
@@ -779,7 +779,7 @@ public abstract class AEBaseGui extends GuiContainer
} }
catch( final Exception err ) catch( final Exception err )
{ {
AELog.warning( "[AppEng] AE prevented crash while drawing slot: " + err.toString() ); AELog.warn( "[AppEng] AE prevented crash while drawing slot: " + err.toString() );
} }
this.setItemRender( pIR ); this.setItemRender( pIR );
return; return;
@@ -846,7 +846,7 @@ public abstract class AEBaseGui extends GuiContainer
} }
catch( final Exception err ) catch( final Exception err )
{ {
AELog.error( err ); AELog.debug( err );
} }
} }
( (AppEngSlot) s ).setIsValid( isValid ? hasCalculatedValidness.Valid : hasCalculatedValidness.Invalid ); ( (AppEngSlot) s ).setIsValid( isValid ? hasCalculatedValidness.Valid : hasCalculatedValidness.Invalid );
@@ -880,7 +880,7 @@ public abstract class AEBaseGui extends GuiContainer
} }
catch( final Exception err ) catch( final Exception err )
{ {
AELog.warning( "[AppEng] AE prevented crash while drawing slot: " + err.toString() ); AELog.warn( "[AppEng] AE prevented crash while drawing slot: " + err.toString() );
} }
} }
// do the usual for non-ME Slots. // do the usual for non-ME Slots.
@@ -556,7 +556,7 @@ public class GuiCraftConfirm extends AEBaseGui
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
@@ -573,7 +573,7 @@ public class GuiCraftConfirm extends AEBaseGui
} }
catch( final Throwable e ) catch( final Throwable e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
} }
@@ -129,7 +129,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
} }
@@ -121,7 +121,7 @@ public class GuiCraftingStatus extends GuiCraftingCPU
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
@@ -233,7 +233,7 @@ public class GuiLevelEmitter extends GuiUpgradeable
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
@@ -269,7 +269,7 @@ public class GuiLevelEmitter extends GuiUpgradeable
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
else else
@@ -199,7 +199,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
@@ -59,7 +59,7 @@ public class GuiNetworkTool extends AEBaseGui
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
@@ -240,7 +240,7 @@ public class GuiPriority extends AEBaseGui
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
@@ -276,7 +276,7 @@ public class GuiPriority extends AEBaseGui
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
else else
@@ -85,7 +85,7 @@ public class GuiQuartzKnife extends AEBaseGui
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
else else
@@ -90,7 +90,7 @@ public class GuiSecurity extends GuiMEMonitorable
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
} }
@@ -137,7 +137,7 @@ public class GuiStorageBus extends GuiUpgradeable
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
} }
@@ -209,7 +209,7 @@ public class RenderBlocksWorkaround extends RenderBlocks
} }
catch( final Throwable t ) catch( final Throwable t )
{ {
AELog.error( t ); AELog.debug( t );
// meh // meh
} }
return false; return false;
@@ -77,9 +77,9 @@ public class TESRWrapper extends TileEntitySpecialRenderer
} }
catch( final Throwable t ) catch( final Throwable t )
{ {
AELog.severe( "Hi, Looks like there was a crash while rendering something..." ); AELog.error( "Hi, Looks like there was a crash while rendering something..." );
t.printStackTrace(); t.printStackTrace();
AELog.severe( "MC will now crash ( probably )!" ); AELog.error( "MC will now crash ( probably )!" );
throw new IllegalStateException( t ); throw new IllegalStateException( t );
} }
} }
@@ -104,9 +104,9 @@ public final class WorldRender implements ISimpleBlockRenderingHandler
if( !this.hasError ) if( !this.hasError )
{ {
this.hasError = true; this.hasError = true;
AELog.severe( "Invalid render - item/block mismatch" ); AELog.error( "Invalid render - item/block mismatch" );
AELog.severe( " item: " + item.getUnlocalizedName() ); AELog.error( " item: " + item.getUnlocalizedName() );
AELog.severe( " block: " + blk.getUnlocalizedName() ); AELog.error( " block: " + blk.getUnlocalizedName() );
} }
} }
} }
@@ -169,7 +169,7 @@ public class RenderBlockCharger extends BaseBlockRender<BlockCharger, TileCharge
} }
catch( final Exception err ) catch( final Exception err )
{ {
AELog.error( err ); AELog.debug( err );
} }
finally finally
{ {
@@ -165,7 +165,7 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU<BlockC
} }
catch( final Exception e ) catch( final Exception e )
{ {
AELog.error( e ); AELog.debug( e );
} }
finally finally
{ {
@@ -318,7 +318,7 @@ public class RenderBlockInscriber extends BaseBlockRender<BlockInscriber, TileIn
} }
catch( final Exception err ) catch( final Exception err )
{ {
AELog.error( err ); AELog.debug( err );
} }
GL11.glPopMatrix(); GL11.glPopMatrix();
@@ -146,7 +146,7 @@ public abstract class AEBaseContainer extends Container
final GuiSync annotation = f.getAnnotation( GuiSync.class ); final GuiSync annotation = f.getAnnotation( GuiSync.class );
if( this.syncData.containsKey( annotation.value() ) ) if( this.syncData.containsKey( annotation.value() ) )
{ {
AELog.warning( "Channel already in use: " + annotation.value() + " for " + f.getName() ); AELog.warn( "Channel already in use: " + annotation.value() + " for " + f.getName() );
} }
else else
{ {
@@ -208,7 +208,7 @@ public abstract class AEBaseContainer extends Container
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
this.dataChunks.clear(); this.dataChunks.clear();
@@ -270,7 +270,7 @@ public abstract class AEBaseContainer extends Container
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
return; return;
} }
} }
@@ -1109,7 +1109,7 @@ public abstract class AEBaseContainer extends Container
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
} }
@@ -1178,7 +1178,7 @@ public abstract class AEBaseContainer extends Container
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
} }
@@ -70,15 +70,15 @@ public class SyncData
} }
catch( final IllegalArgumentException e ) catch( final IllegalArgumentException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
catch( final IllegalAccessException e ) catch( final IllegalAccessException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
@@ -127,11 +127,11 @@ public class SyncData
} }
catch( final IllegalArgumentException e ) catch( final IllegalArgumentException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
catch( final IllegalAccessException e ) catch( final IllegalAccessException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
@@ -143,11 +143,11 @@ public class SyncData
} }
catch( final IllegalArgumentException e ) catch( final IllegalArgumentException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
catch( final IllegalAccessException e ) catch( final IllegalAccessException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
@@ -199,11 +199,11 @@ public class SyncData
} }
catch( final IllegalArgumentException e ) catch( final IllegalArgumentException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
catch( final IllegalAccessException e ) catch( final IllegalAccessException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
} }
@@ -280,7 +280,7 @@ public class ContainerCraftConfirm extends AEBaseContainer
catch( final Throwable e ) catch( final Throwable e )
{ {
this.getPlayerInv().player.addChatMessage( new ChatComponentText( "Error: " + e.toString() ) ); this.getPlayerInv().player.addChatMessage( new ChatComponentText( "Error: " + e.toString() ) );
AELog.error( e ); AELog.debug( e );
this.setValidContainer( false ); this.setValidContainer( false );
this.result = null; this.result = null;
} }
@@ -121,7 +121,7 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
} }
@@ -194,7 +194,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
} }
@@ -237,7 +237,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
@@ -335,7 +335,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
} }
+319 -38
View File
@@ -19,93 +19,374 @@
package appeng.core; package appeng.core;
import org.apache.logging.log4j.Level; import javax.annotation.Nonnull;
import cpw.mods.fml.relauncher.FMLRelaunchLog; import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.message.ParameterizedMessage;
import appeng.core.features.AEFeature; import appeng.core.features.AEFeature;
import appeng.tile.AEBaseTile; import appeng.tile.AEBaseTile;
import appeng.util.Platform; import appeng.util.Platform;
/**
* Utility class for easier logging.
*/
public final class AELog public final class AELog
{ {
public static final FMLRelaunchLog INSTANCE = FMLRelaunchLog.log; private static final String LOGGER_PREFIX = "AE2:";
private static final String SERVER_SUFFIX = "S";
private static final String CLIENT_SUFFIX = "C";
private static final String BLOCK_UPDATE = "Block Update of %s @ ( %d, %d, %d )";
private static final String DEFAULT_EXCEPTION_MESSAGE = "Exception: ";
private AELog() private AELog()
{ {
} }
public static void warning( final String format, final Object... data ) /**
* Returns a {@link Logger} logger suitable for the effective side (client/server).
*
* @return a suitable logger instance
*/
private static Logger getLogger()
{ {
log( Level.WARN, format, data ); final String loggerName = LOGGER_PREFIX + ( Platform.isServer() ? SERVER_SUFFIX : CLIENT_SUFFIX );
final Logger logger = LogManager.getLogger( loggerName );
return logger;
} }
private static void log( final Level level, final String format, final Object... data ) /**
* Indicates of the global log is enabled or disabled.
*
* By default it is enabled.
*
* @return true when the log is enabled.
*/
public static boolean isLogEnabled()
{ {
if( AEConfig.instance == null || AEConfig.instance.isFeatureEnabled( AEFeature.Logging ) ) return AEConfig.instance == null || AEConfig.instance.isFeatureEnabled( AEFeature.Logging );
}
/**
* Logs a formatted message with a specific log level.
*
* This uses {@link String#format(String, Object...)} as opposed to the {@link ParameterizedMessage} to allow a more
* flexible formatting.
*
* The output can be globally disabled via the configuration file.
*
* @param level the intended level.
* @param message the message to be formatted.
* @param params the parameters used for {@link String#format(String, Object...)}.
*/
public static void log( @Nonnull final Level level, @Nonnull final String message, final Object... params )
{
if( AELog.isLogEnabled() )
{ {
FMLRelaunchLog.log( "AE2:" + ( Platform.isServer() ? "S" : "C" ), level, format, data ); final String formattedMessage = String.format( message, params );
final Logger logger = getLogger();
logger.log( level, formattedMessage );
} }
} }
public static void grinder( final String o ) /**
* Log an exception with a custom message formated via {@link String#format(String, Object...)}
*
* Similar to {@link AELog#log(Level, String, Object...)}.
*
* @see AELog#log(Level, String, Object...)
*
* @param level the intended level.
* @param exception
* @param message the message to be formatted.
* @param params the parameters used for {@link String#format(String, Object...)}.
*/
public static void log( @Nonnull final Level level, @Nonnull final Throwable exception, @Nonnull String message, final Object... params )
{ {
if( AEConfig.instance.isFeatureEnabled( AEFeature.GrinderLogging ) ) if( AELog.isLogEnabled() )
{ {
log( Level.DEBUG, "grinder: " + o ); final String formattedMessage = String.format( message, params );
final Logger logger = getLogger();
logger.log( level, formattedMessage, exception );
} }
} }
public static void integration( final Throwable exception ) /**
* @see AELog#log(Level, String, Object...)
* @param format
* @param params
*/
public static void info( @Nonnull final String format, final Object... params )
{ {
if( AEConfig.instance.isFeatureEnabled( AEFeature.IntegrationLogging ) ) log( Level.INFO, format, params );
{
error( exception );
}
} }
public static void error( final Throwable e ) /**
* Log exception as {@link Level#INFO}
*
* @see AELog#log(Level, Throwable, String, Object...)
*
* @param exception
*/
public static void info( @Nonnull final Throwable exception )
{ {
if( AEConfig.instance.isFeatureEnabled( AEFeature.Logging ) ) log( Level.INFO, exception, DEFAULT_EXCEPTION_MESSAGE );
{
severe( "Error: " + e.getClass().getName() + " : " + e.getMessage() );
e.printStackTrace();
}
} }
public static void severe( final String format, final Object... data ) /**
* Log exception as {@link Level#INFO}
*
* @see AELog#log(Level, Throwable, String, Object...)
*
* @param exception
* @param message
*/
public static void info( @Nonnull final Throwable exception, @Nonnull final String message )
{ {
log( Level.ERROR, format, data ); log( Level.INFO, exception, message );
} }
public static void blockUpdate( final int xCoord, final int yCoord, final int zCoord, final AEBaseTile aeBaseTile ) /**
* @see AELog#log(Level, String, Object...)
* @param format
* @param params
*/
public static void warn( @Nonnull final String format, final Object... params )
{ {
if( AEConfig.instance.isFeatureEnabled( AEFeature.UpdateLogging ) ) log( Level.WARN, format, params );
{
info( aeBaseTile.getClass().getName() + " @ " + xCoord + ", " + yCoord + ", " + zCoord );
}
} }
public static void info( final String format, final Object... data ) /**
* Log exception as {@link Level#WARN}
*
* @see AELog#log(Level, Throwable, String, Object...)
*
* @param exception
*/
public static void warn( @Nonnull final Throwable exception )
{ {
log( Level.INFO, format, data ); log( Level.WARN, exception, DEFAULT_EXCEPTION_MESSAGE );
} }
public static void crafting( final String format, final Object... data ) /**
* Log exception as {@link Level#WARN}
*
* @see AELog#log(Level, Throwable, String, Object...)
*
* @param exception
* @param message
*/
public static void warn( @Nonnull final Throwable exception, @Nonnull final String message )
{ {
if( AEConfig.instance.isFeatureEnabled( AEFeature.CraftingLog ) ) log( Level.WARN, exception, message );
{
log( Level.INFO, format, data );
}
} }
public static void debug( final String format, final Object... data ) /**
* @see AELog#log(Level, String, Object...)
* @param format
* @param params
*/
public static void error( @Nonnull final String format, final Object... params )
{ {
if( AEConfig.instance.isFeatureEnabled( AEFeature.DebugLogging ) ) log( Level.ERROR, format, params );
}
/**
* Log exception as {@link Level#ERROR}
*
* @see AELog#log(Level, Throwable, String, Object...)
*
* @param exception
*/
public static void error( @Nonnull final Throwable exception )
{
log( Level.ERROR, exception, DEFAULT_EXCEPTION_MESSAGE );
}
/**
* Log exception as {@link Level#ERROR}
*
* @see AELog#log(Level, Throwable, String, Object...)
*
* @param exception
* @param message
*/
public static void error( @Nonnull final Throwable exception, @Nonnull final String message )
{
log( Level.ERROR, exception, message );
}
/**
* Log message as {@link Level#DEBUG}
*
* @see AELog#log(Level, String, Object...)
* @param format
* @param data
*/
public static void debug( @Nonnull final String format, final Object... data )
{
if( AELog.isDebugLogEnabled() )
{ {
log( Level.DEBUG, format, data ); log( Level.DEBUG, format, data );
} }
} }
/**
* Log exception as {@link Level#DEBUG}
*
* @see AELog#log(Level, Throwable, String, Object...)
*
* @param exception
*/
public static void debug( @Nonnull final Throwable exception )
{
if( AELog.isDebugLogEnabled() )
{
log( Level.DEBUG, exception, DEFAULT_EXCEPTION_MESSAGE );
}
}
/**
* Log exception as {@link Level#DEBUG}
*
* @see AELog#log(Level, Throwable, String, Object...)
*
* @param exception
* @param message
*/
public static void debug( @Nonnull final Throwable exception, @Nonnull final String message )
{
if( AELog.isDebugLogEnabled() )
{
log( Level.DEBUG, exception, message );
}
}
/**
* Use to check for an enabled debug log.
*
* Can be used to prevent the execution of debug logic.
*
* @return true when the debug log is enabled.
*/
public static boolean isDebugLogEnabled()
{
return AEConfig.instance.isFeatureEnabled( AEFeature.DebugLogging );
}
//
// Specialized handlers
//
/**
* A specialized logging for grinder recipes, can be disabled inside configuration file.
*
* @param message String to be logged
*/
public static void grinder( @Nonnull final String message )
{
if( AEConfig.instance.isFeatureEnabled( AEFeature.GrinderLogging ) )
{
log( Level.DEBUG, "grinder: " + message );
}
}
/**
* A specialized logging for mod integration errors, can be disabled inside configuration file.
*
* @param exception
*/
public static void integration( @Nonnull final Throwable exception )
{
if( AEConfig.instance.isFeatureEnabled( AEFeature.IntegrationLogging ) )
{
debug( exception );
}
}
/**
* Logging of block updates.
*
* Off by default, can be enabled inside the configuration file.
*
* @see AELog#log(Level, String, Object...)
* @param xCoord
* @param yCoord
* @param zCoord
* @param aeBaseTile
*/
public static void blockUpdate( final int xCoord, final int yCoord, final int zCoord, @Nonnull final AEBaseTile aeBaseTile )
{
if( AEConfig.instance.isFeatureEnabled( AEFeature.UpdateLogging ) )
{
info( BLOCK_UPDATE, aeBaseTile.getClass().getName(), xCoord, +yCoord, +zCoord );
}
}
/**
* Use to check for an enabled crafting log.
*
* Can be used to prevent the execution of unneeded logic.
*
* @return true when the crafting log is enabled.
*/
public static boolean isCraftingLogEnabled()
{
return AEConfig.instance.isFeatureEnabled( AEFeature.CraftingLog );
}
/**
* Logging for autocrafting.
*
* Off by default, can be enabled inside the configuration file.
*
* @see AELog#log(Level, String, Object...)
* @param message
* @param params
*/
public static void crafting( @Nonnull final String message, final Object... params )
{
if( AELog.isCraftingLogEnabled() )
{
log( Level.INFO, message, params );
}
}
/**
* Use to check for an enabled crafting debug log.
*
* Can be used to prevent the execution of unneeded logic.
*
* @return true when the crafting debug log is enabled.
*/
public static boolean isCraftingDebugLogEnabled()
{
return AEConfig.instance.isFeatureEnabled( AEFeature.CraftingLog ) && AEConfig.instance.isFeatureEnabled( AEFeature.DebugLogging );
}
/**
* Debug logging for autocrafting.
*
* Off by default, can be enabled inside the configuration file.
*
* @see AELog#log(Level, String, Object...)
* @param message
* @param params
*/
public static void craftingDebug( @Nonnull final String message, final Object... params )
{
if( AELog.isCraftingDebugLogEnabled() )
{
log( Level.DEBUG, message, params );
}
}
} }
+2 -2
View File
@@ -95,8 +95,8 @@ public class IMCHandler
} }
catch( final Exception t ) catch( final Exception t )
{ {
AELog.warning( "Problem detected when processing IMC " + key + " from " + message.getSender() ); AELog.warn( "Problem detected when processing IMC " + key + " from " + message.getSender() );
AELog.error( t ); AELog.debug( t );
} }
} }
} }
+2 -2
View File
@@ -100,12 +100,12 @@ public class RecipeLoader implements Runnable
// on failure use jar parsing // on failure use jar parsing
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
this.handler.parseRecipes( new JarLoader( ASSETS_RECIPE_PATH ), "index.recipe" ); this.handler.parseRecipes( new JarLoader( ASSETS_RECIPE_PATH ), "index.recipe" );
} }
catch( final URISyntaxException e ) catch( final URISyntaxException e )
{ {
AELog.error( e ); AELog.debug( e );
this.handler.parseRecipes( new JarLoader( ASSETS_RECIPE_PATH ), "index.recipe" ); this.handler.parseRecipes( new JarLoader( ASSETS_RECIPE_PATH ), "index.recipe" );
} }
} }
+11 -11
View File
@@ -109,7 +109,7 @@ public class ApiPart implements IPartHelper
} }
catch( final ClassNotFoundException e ) catch( final ClassNotFoundException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
Class myCLass; Class myCLass;
@@ -134,8 +134,8 @@ public class ApiPart implements IPartHelper
} }
catch( final Throwable t ) catch( final Throwable t )
{ {
AELog.warning( "Error loading " + name ); AELog.warn( "Error loading " + name );
AELog.error( t ); AELog.debug( t );
// throw new RuntimeException( t ); // throw new RuntimeException( t );
} }
f = myCLass.getName(); f = myCLass.getName();
@@ -164,7 +164,7 @@ public class ApiPart implements IPartHelper
} }
catch( final Throwable t ) catch( final Throwable t )
{ {
AELog.error( t ); AELog.debug( t );
} }
for( final MethodNode mn : n.methods ) for( final MethodNode mn : n.methods )
@@ -197,13 +197,13 @@ public class ApiPart implements IPartHelper
if( !rootC.isInstance( fish ) ) if( !rootC.isInstance( fish ) )
{ {
hasError = true; hasError = true;
AELog.severe( "Error, Expected layer to implement " + root + " did not." ); AELog.error( "Error, Expected layer to implement " + root + " did not." );
} }
if( fish instanceof LayerBase ) if( fish instanceof LayerBase )
{ {
hasError = true; hasError = true;
AELog.severe( "Error, Expected layer to NOT implement LayerBase but it DID." ); AELog.error( "Error, Expected layer to NOT implement LayerBase but it DID." );
} }
if( !fullPath.contains( ".fmp." ) ) if( !fullPath.contains( ".fmp." ) )
@@ -211,13 +211,13 @@ public class ApiPart implements IPartHelper
if( !( fish instanceof TileCableBus ) ) if( !( fish instanceof TileCableBus ) )
{ {
hasError = true; hasError = true;
AELog.severe( "Error, Expected layer to implement TileCableBus did not." ); AELog.error( "Error, Expected layer to implement TileCableBus did not." );
} }
if( !( fish instanceof TileEntity ) ) if( !( fish instanceof TileEntity ) )
{ {
hasError = true; hasError = true;
AELog.severe( "Error, Expected layer to implement TileEntity did not." ); AELog.error( "Error, Expected layer to implement TileEntity did not." );
} }
} }
@@ -228,8 +228,8 @@ public class ApiPart implements IPartHelper
} }
catch( final Throwable t ) catch( final Throwable t )
{ {
AELog.severe( "Layer: " + n.name + " Failed." ); AELog.error( "Layer: " + n.name + " Failed." );
AELog.error( t ); AELog.debug( t );
} }
this.roots.put( fullPath, clazz ); this.roots.put( fullPath, clazz );
@@ -297,7 +297,7 @@ public class ApiPart implements IPartHelper
} }
catch( final Exception e ) catch( final Exception e )
{ {
AELog.error( e ); AELog.debug( e );
throw new IllegalStateException( "Unable to manage part API.", e ); throw new IllegalStateException( "Unable to manage part API.", e );
} }
return clazz; return clazz;
@@ -61,22 +61,22 @@ public final class GridCacheRegistry implements IGridCacheRegistry
} }
catch( final NoSuchMethodException e ) catch( final NoSuchMethodException e )
{ {
AELog.severe( "Grid Caches must have a constructor with IGrid as the single param." ); AELog.error( "Grid Caches must have a constructor with IGrid as the single param." );
throw new IllegalArgumentException( e ); throw new IllegalArgumentException( e );
} }
catch( final InvocationTargetException e ) catch( final InvocationTargetException e )
{ {
AELog.severe( "Grid Caches must have a constructor with IGrid as the single param." ); AELog.error( "Grid Caches must have a constructor with IGrid as the single param." );
throw new IllegalStateException( e ); throw new IllegalStateException( e );
} }
catch( final InstantiationException e ) catch( final InstantiationException e )
{ {
AELog.severe( "Grid Caches must have a constructor with IGrid as the single param." ); AELog.error( "Grid Caches must have a constructor with IGrid as the single param." );
throw new IllegalStateException( e ); throw new IllegalStateException( e );
} }
catch( final IllegalAccessException e ) catch( final IllegalAccessException e )
{ {
AELog.severe( "Grid Caches must have a constructor with IGrid as the single param." ); AELog.error( "Grid Caches must have a constructor with IGrid as the single param." );
throw new IllegalStateException( e ); throw new IllegalStateException( e );
} }
} }
@@ -72,8 +72,8 @@ public class RecipeHandlerRegistry implements IRecipeHandlerRegistry
} }
catch( final Throwable e ) catch( final Throwable e )
{ {
AELog.severe( "Error Caused when trying to construct " + clz.getName() ); AELog.error( "Error Caused when trying to construct " + clz.getName() );
AELog.error( e ); AELog.debug( e );
this.handlers.put( name, null ); // clear it.. this.handlers.put( name, null ); // clear it..
@@ -101,7 +101,7 @@ public class RecipeHandlerRegistry implements IRecipeHandlerRegistry
} }
catch( final Throwable t ) catch( final Throwable t )
{ {
AELog.error( t ); AELog.debug( t );
} }
if( rr != null ) if( rr != null )
@@ -51,19 +51,19 @@ public class AppEngClientPacketHandler extends AppEngPacketHandlerBase implement
} }
catch( final InstantiationException e ) catch( final InstantiationException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
catch( final IllegalAccessException e ) catch( final IllegalAccessException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
catch( final IllegalArgumentException e ) catch( final IllegalArgumentException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
catch( final InvocationTargetException e ) catch( final InvocationTargetException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
} }
@@ -48,19 +48,19 @@ public final class AppEngServerPacketHandler extends AppEngPacketHandlerBase imp
} }
catch( final InstantiationException e ) catch( final InstantiationException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
catch( final IllegalAccessException e ) catch( final IllegalAccessException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
catch( final IllegalArgumentException e ) catch( final IllegalArgumentException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
catch( final InvocationTargetException e ) catch( final InvocationTargetException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
} }
@@ -121,7 +121,7 @@ public class PacketCraftRequest extends AppEngPacket
{ {
futureJob.cancel( true ); futureJob.cancel( true );
} }
AELog.error( e ); AELog.debug( e );
} }
} }
} }
@@ -186,7 +186,7 @@ public class PacketMEInventoryUpdate extends AppEngPacket
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
return null; return null;
@@ -33,7 +33,6 @@ import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property; import net.minecraftforge.common.config.Property;
import appeng.core.AELog;
import appeng.core.CommonHelper; import appeng.core.CommonHelper;
@@ -64,7 +63,7 @@ final class PlayerData implements IWorldPlayerData, IOnWorldStartable, IOnWorldS
this.config = configFile; this.config = configFile;
final ConfigCategory playerList = this.config.getCategory( "players" ); final ConfigCategory playerList = this.config.getCategory( "players" );
this.playerMapping = new PlayerMapping( playerList, AELog.INSTANCE ); this.playerMapping = new PlayerMapping( playerList );
} }
@Nullable @Nullable
@@ -29,8 +29,6 @@ import com.google.common.base.Preconditions;
import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.ConfigCategory;
import cpw.mods.fml.relauncher.FMLRelaunchLog;
/** /**
* Wrapper class for the player mappings. * Wrapper class for the player mappings.
@@ -46,9 +44,9 @@ final class PlayerMapping implements IWorldPlayerMapping
*/ */
private final Map<Integer, UUID> mappings; private final Map<Integer, UUID> mappings;
public PlayerMapping( final ConfigCategory category, final FMLRelaunchLog log ) public PlayerMapping( final ConfigCategory category )
{ {
final PlayerMappingsInitializer init = new PlayerMappingsInitializer( category, log ); final PlayerMappingsInitializer init = new PlayerMappingsInitializer( category );
this.mappings = init.getPlayerMappings(); this.mappings = init.getPlayerMappings();
} }
@@ -26,8 +26,6 @@ import java.util.UUID;
import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.Property; import net.minecraftforge.common.config.Property;
import cpw.mods.fml.relauncher.FMLRelaunchLog;
import appeng.core.AELog; import appeng.core.AELog;
import appeng.util.UUIDMatcher; import appeng.util.UUIDMatcher;
@@ -53,7 +51,7 @@ class PlayerMappingsInitializer
* @param playerList the category for the player list, generally extracted using the "players" tag * @param playerList the category for the player list, generally extracted using the "players" tag
* @param log the logger used to warn the server or user of faulty entries * @param log the logger used to warn the server or user of faulty entries
*/ */
PlayerMappingsInitializer( final ConfigCategory playerList, final FMLRelaunchLog log ) PlayerMappingsInitializer( final ConfigCategory playerList )
{ {
// Matcher for UUIDs // Matcher for UUIDs
final UUIDMatcher matcher = new UUIDMatcher(); final UUIDMatcher matcher = new UUIDMatcher();
@@ -78,7 +76,7 @@ class PlayerMappingsInitializer
} }
else else
{ {
AELog.warning( "The configuration for players contained an outdated entry instead an expected UUID " + maybeUUID + " for the player " + id + ". Please clean this up." ); AELog.warn( "The configuration for players contained an outdated entry instead an expected UUID " + maybeUUID + " for the player " + id + ". Please clean this up." );
} }
} }
} }
@@ -153,7 +153,7 @@ final class SpawnData implements IWorldSpawnData
catch( final Throwable e ) catch( final Throwable e )
{ {
data = new NBTTagCompound(); data = new NBTTagCompound();
AELog.error( e ); AELog.debug( e );
} }
finally finally
{ {
@@ -165,7 +165,7 @@ final class SpawnData implements IWorldSpawnData
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
} }
@@ -196,7 +196,7 @@ final class SpawnData implements IWorldSpawnData
} }
catch( final Throwable e ) catch( final Throwable e )
{ {
AELog.error( e ); AELog.debug( e );
} }
finally finally
{ {
@@ -208,7 +208,7 @@ final class SpawnData implements IWorldSpawnData
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
} }
@@ -140,7 +140,7 @@ final class StorageData implements IWorldGridStorageData, IOnWorldStartable, IOn
} }
catch( final NumberFormatException err ) catch( final NumberFormatException err )
{ {
AELog.warning( "The config contained a value which was not represented as a Long: %s", lastString ); AELog.warn( "The config contained a value which was not represented as a Long: %s", lastString );
this.lastGridStorage = 0; this.lastGridStorage = 0;
} }
+52 -16
View File
@@ -24,26 +24,35 @@ import java.util.concurrent.TimeUnit;
import com.google.common.base.Stopwatch; import com.google.common.base.Stopwatch;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.config.Actionable; import appeng.api.config.Actionable;
import appeng.api.networking.IGrid; import appeng.api.networking.IGrid;
import appeng.api.networking.IGridHost;
import appeng.api.networking.IGridNode;
import appeng.api.networking.crafting.ICraftingCallback; import appeng.api.networking.crafting.ICraftingCallback;
import appeng.api.networking.crafting.ICraftingGrid; import appeng.api.networking.crafting.ICraftingGrid;
import appeng.api.networking.crafting.ICraftingJob; import appeng.api.networking.crafting.ICraftingJob;
import appeng.api.networking.crafting.ICraftingPatternDetails; import appeng.api.networking.crafting.ICraftingPatternDetails;
import appeng.api.networking.security.BaseActionSource; import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.security.IActionHost;
import appeng.api.networking.security.MachineSource;
import appeng.api.networking.security.PlayerSource;
import appeng.api.networking.storage.IStorageGrid; import appeng.api.networking.storage.IStorageGrid;
import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList; import appeng.api.storage.data.IItemList;
import appeng.api.util.DimensionalCoord;
import appeng.core.AELog; import appeng.core.AELog;
import appeng.hooks.TickHandler; import appeng.hooks.TickHandler;
public class CraftingJob implements Runnable, ICraftingJob public class CraftingJob implements Runnable, ICraftingJob
{ {
private static final String LOG_CRAFTING_JOB = "CraftingJob (%s) issued by %s requesting [%s] using %s bytes took %s ms";
private static final String LOG_MACHINE_SOURCE_DETAILS = "Machine[object=%s, %s]";
private final MECraftingInventory original; private final MECraftingInventory original;
private final World world; private final World world;
@@ -145,7 +154,7 @@ public class CraftingJob implements Runnable, ICraftingJob
AELog.crafting( s + " * " + ti.times + " = " + ( ti.perOp * ti.times ) ); AELog.crafting( s + " * " + ti.times + " = " + ( ti.perOp * ti.times ) );
} }
AELog.crafting( "------------- " + this.bytes + "b real" + timer.elapsed( TimeUnit.MILLISECONDS ) + "ms" ); this.logCraftingJob( "real", timer );
// if ( mode == Actionable.MODULATE ) // if ( mode == Actionable.MODULATE )
// craftingInventory.moveItemsToStorage( storage ); // craftingInventory.moveItemsToStorage( storage );
} }
@@ -171,15 +180,15 @@ public class CraftingJob implements Runnable, ICraftingJob
AELog.crafting( s + " * " + ti.times + " = " + ( ti.perOp * ti.times ) ); AELog.crafting( s + " * " + ti.times + " = " + ( ti.perOp * ti.times ) );
} }
AELog.crafting( "------------- " + this.bytes + "b simulate" + timer.elapsed( TimeUnit.MILLISECONDS ) + "ms" ); this.logCraftingJob( "simulate", timer );
} }
catch( final CraftBranchFailure e1 ) catch( final CraftBranchFailure e1 )
{ {
AELog.error( e1 ); AELog.debug( e1 );
} }
catch( final CraftingCalculationFailure f ) catch( final CraftingCalculationFailure f )
{ {
AELog.error( f ); AELog.debug( f );
} }
catch( final InterruptedException e1 ) catch( final InterruptedException e1 )
{ {
@@ -190,7 +199,7 @@ public class CraftingJob implements Runnable, ICraftingJob
} }
catch( final CraftingCalculationFailure f ) catch( final CraftingCalculationFailure f )
{ {
AELog.error( f ); AELog.debug( f );
} }
catch( final InterruptedException e1 ) catch( final InterruptedException e1 )
{ {
@@ -199,7 +208,7 @@ public class CraftingJob implements Runnable, ICraftingJob
return; return;
} }
this.log( "crafting job now done" ); AELog.craftingDebug( "crafting job now done" );
} }
catch( final Throwable t ) catch( final Throwable t )
{ {
@@ -227,14 +236,14 @@ public class CraftingJob implements Runnable, ICraftingJob
if( !this.running ) if( !this.running )
{ {
this.log( "crafting job will now sleep" ); AELog.craftingDebug( "crafting job will now sleep" );
while( !this.running ) while( !this.running )
{ {
this.monitor.wait(); this.monitor.wait();
} }
this.log( "crafting job now active" ); AELog.craftingDebug( "crafting job now active" );
} }
} }
@@ -263,11 +272,6 @@ public class CraftingJob implements Runnable, ICraftingJob
} }
} }
private void log( final String string )
{
// AELog.crafting( string );
}
@Override @Override
public boolean isSimulation() public boolean isSimulation()
{ {
@@ -327,7 +331,7 @@ public class CraftingJob implements Runnable, ICraftingJob
this.watch.start(); this.watch.start();
this.running = true; this.running = true;
this.log( "main thread is now going to sleep" ); AELog.craftingDebug( "main thread is now going to sleep" );
this.monitor.notify(); this.monitor.notify();
@@ -342,7 +346,7 @@ public class CraftingJob implements Runnable, ICraftingJob
} }
} }
this.log( "main thread is now active" ); AELog.craftingDebug( "main thread is now active" );
} }
return true; return true;
@@ -363,9 +367,41 @@ public class CraftingJob implements Runnable, ICraftingJob
this.tree = tree; this.tree = tree;
} }
private void logCraftingJob( String type, Stopwatch timer )
{
if( AELog.isCraftingLogEnabled() )
{
final String itemToOutput = this.output.toString();
final long elapsedTime = timer.elapsed( TimeUnit.MILLISECONDS );
final String actionSource;
if( this.actionSrc instanceof MachineSource )
{
final IActionHost machineSource = ( (MachineSource) this.actionSrc ).via;
final IGridNode actionableNode = machineSource.getActionableNode();
final IGridHost machine = actionableNode.getMachine();
final DimensionalCoord location = actionableNode.getGridBlock().getLocation();
actionSource = String.format( LOG_MACHINE_SOURCE_DETAILS, machine, location );
}
else if( this.actionSrc instanceof PlayerSource )
{
final PlayerSource source = (PlayerSource) this.actionSrc;
final EntityPlayer player = source.player;
actionSource = player.toString();
}
else
{
actionSource = "[unknown source]";
}
AELog.crafting( LOG_CRAFTING_JOB, type, actionSource, itemToOutput, this.bytes, elapsedTime );
}
}
private static class TwoIntegers private static class TwoIntegers
{ {
private final long perOp = 0; private final long perOp = 0;
private final long times = 0; private final long times = 0;
} }
+1 -1
View File
@@ -339,7 +339,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
} }
catch( final Throwable t ) catch( final Throwable t )
{ {
AELog.error( t ); AELog.debug( t );
} }
} }
} }
+2 -2
View File
@@ -259,7 +259,7 @@ public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IMask
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
@@ -322,7 +322,7 @@ public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IMask
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
+1 -1
View File
@@ -289,7 +289,7 @@ public class TickHandler
} }
catch( final Exception e ) catch( final Exception e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
@@ -119,11 +119,11 @@ public class BuildCraftBuilder implements IIntegrationModule
} }
catch( final InvocationTargetException ignore ) catch( final InvocationTargetException ignore )
{ {
AELog.warning( "Encountered problems while initializing the BuildCraft Builder support. Can not invoke the method %s", blockDefinition ); AELog.warn( "Encountered problems while initializing the BuildCraft Builder support. Can not invoke the method %s", blockDefinition );
} }
catch( final IllegalAccessException ignore ) catch( final IllegalAccessException ignore )
{ {
AELog.warning( "Encountered problems while initializing the BuildCraft Builder support. Can not access the method %s", blockDefinition ); AELog.warn( "Encountered problems while initializing the BuildCraft Builder support. Can not access the method %s", blockDefinition );
} }
} }
} }
@@ -178,7 +178,7 @@ public class FMP implements IIntegrationModule, IPartFactory, IPartConverter, IF
} }
catch( final Throwable t ) catch( final Throwable t )
{ {
AELog.error( t ); AELog.debug( t );
} }
return null; return null;
} }
@@ -211,8 +211,8 @@ public class FMP implements IIntegrationModule, IPartFactory, IPartConverter, IF
} }
catch( final Throwable t ) catch( final Throwable t )
{ {
AELog.severe( "Failed to register " + layerInterface.getName() + " with FMP, some features may not work with MultiParts." ); AELog.error( "Failed to register " + layerInterface.getName() + " with FMP, some features may not work with MultiParts." );
AELog.error( t ); AELog.debug( t );
} }
} }
@@ -72,7 +72,7 @@ public class ImmibisMicroblocks implements IImmibisMicroblocks, IIntegrationModu
} }
catch( final Throwable t ) catch( final Throwable t )
{ {
AELog.error( t ); AELog.debug( t );
} }
} }
@@ -263,7 +263,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
} }
catch( final Exception err ) catch( final Exception err )
{ {
AELog.error( err ); AELog.debug( err );
} }
if( pos != null && type != null && type.getItem() instanceof ItemPaintBall ) if( pos != null && type != null && type.getItem() instanceof ItemPaintBall )
@@ -385,7 +385,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
} }
catch( final Exception err ) catch( final Exception err )
{ {
AELog.error( err ); AELog.debug( err );
} }
if( pos != null ) if( pos != null )
+1 -1
View File
@@ -110,7 +110,7 @@ public class GridStorage implements IGridStorage
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
return ""; return "";
+4 -4
View File
@@ -184,10 +184,10 @@ public class NetworkEventBus
} }
catch( final Throwable e1 ) catch( final Throwable e1 )
{ {
AELog.severe( "[AppEng] Network Event caused exception:" ); AELog.error( "[AppEng] Network Event caused exception:" );
AELog.severe( "Offending Class: " + obj.getClass().getName() ); AELog.error( "Offending Class: " + obj.getClass().getName() );
AELog.severe( "Offending Object: " + obj.toString() ); AELog.error( "Offending Object: " + obj.toString() );
AELog.error( e1 ); AELog.debug( e1 );
throw new IllegalStateException( e1 ); throw new IllegalStateException( e1 );
} }
@@ -116,7 +116,7 @@ public abstract class MBCalculator
} }
catch( final Throwable err ) catch( final Throwable err )
{ {
AELog.error( err ); AELog.debug( err );
} }
this.disconnect(); this.disconnect();
@@ -83,6 +83,8 @@ import appeng.util.item.AEItemStack;
public final class CraftingCPUCluster implements IAECluster, ICraftingCPU public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
{ {
private static final String LOG_MARK_AS_COMPLETE = "Completed job for %s.";
private final WorldCoord min; private final WorldCoord min;
private final WorldCoord max; private final WorldCoord max;
private final int[] usedOps = new int[3]; private final int[] usedOps = new int[3];
@@ -427,12 +429,19 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
( (CraftingLink) this.myLastLink ).markDone(); ( (CraftingLink) this.myLastLink ).markDone();
} }
AELog.crafting( "marking job as complete" ); if( AELog.isCraftingLogEnabled() )
{
final IAEItemStack logStack = this.finalOutput.copy();
logStack.setStackSize( this.startItemCount );
AELog.crafting( LOG_MARK_AS_COMPLETE, logStack );
}
this.remainingItemCount = 0; this.remainingItemCount = 0;
this.startItemCount = 0; this.startItemCount = 0;
this.lastTime = 0; this.lastTime = 0;
this.elapsedTime = 0; this.elapsedTime = 0;
this.isComplete = true; this.isComplete = true;
} }
private void updateCPU() private void updateCPU()
@@ -1074,7 +1074,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
} }
else else
{ {
AELog.warning( "Invalid NBT For CableBus Container: " + iss.getItem().getClass().getName() + " is not a valid part; it was ignored." ); AELog.warn( "Invalid NBT For CableBus Container: " + iss.getItem().getClass().getName() + " is not a valid part; it was ignored." );
} }
} }
} }
@@ -299,7 +299,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
} }
catch( final GridAccessException e ) catch( final GridAccessException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
return items; return items;
@@ -194,7 +194,7 @@ public final class PartP2POpenComputers extends PartP2PTunnel<PartP2POpenCompute
} }
catch( final GridAccessException e ) catch( final GridAccessException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
} }
@@ -233,14 +233,14 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
{ {
final TileEntity start = this.getTile(); final TileEntity start = this.getTile();
final TileEntity end = me.getTile(); final TileEntity end = me.getTile();
AELog.warning( "Failed to establish a ME P2P Tunnel between the tunnels at [x=%d, y=%d, z=%d] and [x=%d, y=%d, z=%d]", start.xCoord, start.yCoord, start.zCoord, end.xCoord, end.yCoord, end.zCoord ); AELog.warn( "Failed to establish a ME P2P Tunnel between the tunnels at [x=%d, y=%d, z=%d] and [x=%d, y=%d, z=%d]", start.xCoord, start.yCoord, start.zCoord, end.xCoord, end.yCoord, end.zCoord );
// :( // :(
} }
} }
} }
catch( final GridAccessException e ) catch( final GridAccessException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
} }
@@ -370,7 +370,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
} }
catch( final Exception e ) catch( final Exception e )
{ {
AELog.error( e ); AELog.debug( e );
} }
finally finally
{ {
+13 -13
View File
@@ -257,10 +257,10 @@ public class RecipeHandler implements IRecipeHandler
} }
catch( final Exception err ) catch( final Exception err )
{ {
AELog.warning( "Error Loading Recipe File:" + path ); AELog.warn( "Error Loading Recipe File:" + path );
if( this.data.exceptions ) if( this.data.exceptions )
{ {
AELog.error( err ); AELog.debug( err );
} }
return; return;
} }
@@ -360,7 +360,7 @@ public class RecipeHandler implements IRecipeHandler
} }
catch( final Throwable e ) catch( final Throwable e )
{ {
AELog.error( e ); AELog.debug( e );
if( this.data.crash ) if( this.data.crash )
{ {
throw new IllegalStateException( e ); throw new IllegalStateException( e );
@@ -398,10 +398,10 @@ public class RecipeHandler implements IRecipeHandler
} }
catch( final RegistrationError e ) catch( final RegistrationError e )
{ {
AELog.warning( "Unable to register a recipe: " + e.getMessage() ); AELog.warn( "Unable to register a recipe: " + e.getMessage() );
if( this.data.exceptions ) if( this.data.exceptions )
{ {
AELog.error( e ); AELog.debug( e );
} }
if( this.data.crash ) if( this.data.crash )
{ {
@@ -412,10 +412,10 @@ public class RecipeHandler implements IRecipeHandler
{ {
if( this.data.errorOnMissing ) if( this.data.errorOnMissing )
{ {
AELog.warning( "Unable to register a recipe:" + e.getMessage() ); AELog.warn( "Unable to register a recipe:" + e.getMessage() );
if( this.data.exceptions ) if( this.data.exceptions )
{ {
AELog.error( e ); AELog.debug( e );
} }
if( this.data.crash ) if( this.data.crash )
{ {
@@ -429,7 +429,7 @@ public class RecipeHandler implements IRecipeHandler
{ {
if( this.data.exceptions ) if( this.data.exceptions )
{ {
AELog.error( e ); AELog.debug( e );
} }
if( this.data.crash ) if( this.data.crash )
{ {
@@ -505,11 +505,11 @@ public class RecipeHandler implements IRecipeHandler
} }
catch( final FileNotFoundException e1 ) catch( final FileNotFoundException e1 )
{ {
AELog.error( e1 ); AELog.debug( e1 );
} }
catch( final IOException e1 ) catch( final IOException e1 )
{ {
AELog.error( e1 ); AELog.debug( e1 );
} }
} }
} }
@@ -529,7 +529,7 @@ public class RecipeHandler implements IRecipeHandler
} }
catch( final Throwable t ) catch( final Throwable t )
{ {
AELog.error( t ); AELog.debug( t );
} }
} }
@@ -678,10 +678,10 @@ public class RecipeHandler implements IRecipeHandler
} }
catch( final RecipeError e ) catch( final RecipeError e )
{ {
AELog.warning( "Recipe Error '" + e.getMessage() + "' near line:" + line + " in " + file + " with: " + this.tokens.toString() ); AELog.warn( "Recipe Error '" + e.getMessage() + "' near line:" + line + " in " + file + " with: " + this.tokens.toString() );
if( this.data.exceptions ) if( this.data.exceptions )
{ {
AELog.error( e ); AELog.debug( e );
} }
if( this.data.crash ) if( this.data.crash )
{ {
@@ -118,7 +118,7 @@ public class Shaped implements ICraftHandler, IWebsiteSerializer
} }
catch( final Throwable e ) catch( final Throwable e )
{ {
AELog.error( e ); AELog.debug( e );
throw new RegistrationError( "Error while adding shaped recipe." ); throw new RegistrationError( "Error while adding shaped recipe." );
} }
} }
@@ -81,7 +81,7 @@ public class Shapeless implements ICraftHandler, IWebsiteSerializer
} }
catch( final Throwable e ) catch( final Throwable e )
{ {
AELog.error( e ); AELog.debug( e );
throw new RegistrationError( "Error while adding shapeless recipe." ); throw new RegistrationError( "Error while adding shapeless recipe." );
} }
} }
@@ -89,7 +89,7 @@ public class OreDictionaryHandler
} }
catch( final Throwable e ) catch( final Throwable e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
} }
@@ -102,7 +102,7 @@ public final class VersionChecker implements Runnable
catch( Exception exception ) catch( Exception exception )
{ {
// Log any unhandled exception to prevent the JVM from reporting them as unhandled. // Log any unhandled exception to prevent the JVM from reporting them as unhandled.
AELog.error( exception ); AELog.debug( exception );
} }
AELog.info( "Stopping AE2 VersionChecker" ); AELog.info( "Stopping AE2 VersionChecker" );
@@ -73,7 +73,8 @@ final class MinecraftItemCSVExporter implements Exporter
/** /**
* @param exportDirectory directory of the resulting export file. Non-null required. * @param exportDirectory directory of the resulting export file. Non-null required.
* @param itemRegistry the registry with minecraft items. Needs to be populated at that time, thus the exporting can only happen in init (pre-init is the * @param itemRegistry the registry with minecraft items. Needs to be populated at that time, thus the exporting can
* only happen in init (pre-init is the
* phase when all items are determined) * phase when all items are determined)
* @param mode mode in which the export should be operated. Resulting CSV will change depending on this. * @param mode mode in which the export should be operated. Resulting CSV will change depending on this.
*/ */
@@ -103,7 +104,7 @@ final class MinecraftItemCSVExporter implements Exporter
{ {
FileUtils.forceMkdir( this.exportDirectory ); FileUtils.forceMkdir( this.exportDirectory );
final Writer writer = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( file ), Charset.forName("UTF-8") ) ); final Writer writer = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( file ), Charset.forName( "UTF-8" ) ) );
final String header = this.mode == ExportMode.MINIMAL ? MINIMAL_HEADER : VERBOSE_HEADER; final String header = this.mode == ExportMode.MINIMAL ? MINIMAL_HEADER : VERBOSE_HEADER;
writer.write( header ); writer.write( header );
@@ -116,8 +117,8 @@ final class MinecraftItemCSVExporter implements Exporter
} }
catch( final IOException e ) catch( final IOException e )
{ {
AELog.warning( EXPORT_UNSUCCESSFUL_MESSAGE ); AELog.warn( EXPORT_UNSUCCESSFUL_MESSAGE );
AELog.error( e ); AELog.debug( e );
} }
} }
@@ -186,7 +187,6 @@ final class MinecraftItemCSVExporter implements Exporter
} }
} }
/** /**
* transforms an item into a row representation of the CSV file * transforms an item into a row representation of the CSV file
*/ */
@@ -198,6 +198,7 @@ final class MinecraftItemCSVExporter implements Exporter
private static final String LOCALIZATION_NAME_EXTENSION = ".name"; private static final String LOCALIZATION_NAME_EXTENSION = ".name";
private static final String EXPORTING_NOTHING_MESSAGE = "Exporting nothing"; private static final String EXPORTING_NOTHING_MESSAGE = "Exporting nothing";
private static final String EXPORTING_SUBTYPES_MESSAGE = "Exporting input %s with subtypes: %b"; private static final String EXPORTING_SUBTYPES_MESSAGE = "Exporting input %s with subtypes: %b";
private static final String EXPORTING_SUBTYPES_FAILED_MESSAGE = "Could not export subtypes of: %s";
@Nonnull @Nonnull
private final FMLControlledNamespacedRegistry<Item> itemRegistry; private final FMLControlledNamespacedRegistry<Item> itemRegistry;
@@ -243,7 +244,8 @@ final class MinecraftItemCSVExporter implements Exporter
} }
catch( final Exception ignored ) catch( final Exception ignored )
{ {
AELog.error( ignored ); AELog.warn( EXPORTING_SUBTYPES_FAILED_MESSAGE, input.getUnlocalizedName() );
AELog.debug( ignored );
// ignore if mods do bullshit in their code // ignore if mods do bullshit in their code
return null; return null;
@@ -67,7 +67,7 @@ public final class ModVersionFetcher implements VersionFetcher
} }
catch( final VersionCheckerException e ) catch( final VersionCheckerException e )
{ {
AELog.error( e ); AELog.debug( e );
return EXCEPTIONAL_VERSION; return EXCEPTIONAL_VERSION;
} }
@@ -75,15 +75,15 @@ public final class ReleaseFetcher
} }
catch( final VersionCheckerException e ) catch( final VersionCheckerException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
catch( MalformedURLException e ) catch( MalformedURLException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
catch( IOException e ) catch( IOException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
return EXCEPTIONAL_RELEASE; return EXCEPTIONAL_RELEASE;
@@ -178,7 +178,7 @@ public class CachedPlane
} }
catch( final Exception e ) catch( final Exception e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
} }
@@ -292,7 +292,7 @@ public class CachedPlane
} }
catch( final Throwable e ) catch( final Throwable e )
{ {
AELog.error( e ); AELog.debug( e );
// attempt recovery... // attempt recovery...
te.setWorldObj( this.getWorld() ); te.setWorldObj( this.getWorld() );
@@ -319,7 +319,7 @@ public class CachedPlane
} }
catch( final Throwable e ) catch( final Throwable e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
+3 -3
View File
@@ -199,7 +199,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
} }
catch( final Throwable t ) catch( final Throwable t )
{ {
AELog.error( t ); AELog.debug( t );
} }
stream.capacity( stream.readableBytes() ); stream.capacity( stream.readableBytes() );
@@ -279,7 +279,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
} }
catch( final Throwable t ) catch( final Throwable t )
{ {
AELog.error( t ); AELog.debug( t );
} }
return output; return output;
@@ -319,7 +319,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
} }
catch( final Throwable t ) catch( final Throwable t )
{ {
AELog.error( t ); AELog.debug( t );
} }
} }
@@ -99,4 +99,5 @@ public abstract class AENetworkInvTile extends AEBaseInvTile implements IActionH
{ {
return this.getProxy().getNode(); return this.getProxy().getNode();
} }
} }
@@ -125,7 +125,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
} }
catch( final Exception e ) catch( final Exception e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
} }
@@ -272,7 +272,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
} }
catch( final Exception e ) catch( final Exception e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
} }
@@ -113,7 +113,7 @@ public class ClassInstantiation<T>
} }
catch( final Throwable t ) catch( final Throwable t )
{ {
AELog.error( t ); AELog.debug( t );
} }
} }
} }
+1 -1
View File
@@ -125,7 +125,7 @@ public final class ConfigManager implements IConfigManager
} }
catch( final IllegalArgumentException e ) catch( final IllegalArgumentException e )
{ {
AELog.error( e ); AELog.debug( e );
} }
} }
} }
+4 -4
View File
@@ -576,8 +576,8 @@ public class Platform
} }
catch( final Throwable z ) catch( final Throwable z )
{ {
AELog.error( t ); AELog.debug( t );
AELog.error( z ); AELog.debug( z );
} }
} }
} }
@@ -589,7 +589,7 @@ public class Platform
} }
catch( final Throwable t ) catch( final Throwable t )
{ {
AELog.error( t ); AELog.debug( t );
} }
return new ArrayList<NBTBase>(); return new ArrayList<NBTBase>();
@@ -2010,7 +2010,7 @@ public class Platform
} }
catch( final Throwable t ) catch( final Throwable t )
{ {
AELog.error( t ); AELog.debug( t );
} }
} }