Merge pull request #2010 from yueh/feature-logger-refactoring
Refactored the logging
This commit is contained in:
commit
17bdd085b1
|
@ -413,7 +413,7 @@ public class ClientHelper extends ServerHelper
|
|||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -410,7 +410,7 @@ public abstract class AEBaseGui extends GuiContainer
|
|||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
else if( slot instanceof SlotCraftingTerm )
|
||||
|
@ -779,7 +779,7 @@ public abstract class AEBaseGui extends GuiContainer
|
|||
}
|
||||
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 );
|
||||
return;
|
||||
|
@ -846,7 +846,7 @@ public abstract class AEBaseGui extends GuiContainer
|
|||
}
|
||||
catch( final Exception err )
|
||||
{
|
||||
AELog.error( err );
|
||||
AELog.debug( err );
|
||||
}
|
||||
}
|
||||
( (AppEngSlot) s ).setIsValid( isValid ? hasCalculatedValidness.Valid : hasCalculatedValidness.Invalid );
|
||||
|
@ -880,7 +880,7 @@ public abstract class AEBaseGui extends GuiContainer
|
|||
}
|
||||
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.
|
||||
|
|
|
@ -556,7 +556,7 @@ public class GuiCraftConfirm extends AEBaseGui
|
|||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -573,7 +573,7 @@ public class GuiCraftConfirm extends AEBaseGui
|
|||
}
|
||||
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 )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ public class GuiCraftingStatus extends GuiCraftingCPU
|
|||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -233,7 +233,7 @@ public class GuiLevelEmitter extends GuiUpgradeable
|
|||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -269,7 +269,7 @@ public class GuiLevelEmitter extends GuiUpgradeable
|
|||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -199,7 +199,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ public class GuiNetworkTool extends AEBaseGui
|
|||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ public class GuiPriority extends AEBaseGui
|
|||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,7 @@ public class GuiPriority extends AEBaseGui
|
|||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -85,7 +85,7 @@ public class GuiQuartzKnife extends AEBaseGui
|
|||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -90,7 +90,7 @@ public class GuiSecurity extends GuiMEMonitorable
|
|||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ public class GuiStorageBus extends GuiUpgradeable
|
|||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -209,7 +209,7 @@ public class RenderBlocksWorkaround extends RenderBlocks
|
|||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
AELog.error( t );
|
||||
AELog.debug( t );
|
||||
// meh
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -77,9 +77,9 @@ public class TESRWrapper extends TileEntitySpecialRenderer
|
|||
}
|
||||
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();
|
||||
AELog.severe( "MC will now crash ( probably )!" );
|
||||
AELog.error( "MC will now crash ( probably )!" );
|
||||
throw new IllegalStateException( t );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,9 +104,9 @@ public final class WorldRender implements ISimpleBlockRenderingHandler
|
|||
if( !this.hasError )
|
||||
{
|
||||
this.hasError = true;
|
||||
AELog.severe( "Invalid render - item/block mismatch" );
|
||||
AELog.severe( " item: " + item.getUnlocalizedName() );
|
||||
AELog.severe( " block: " + blk.getUnlocalizedName() );
|
||||
AELog.error( "Invalid render - item/block mismatch" );
|
||||
AELog.error( " item: " + item.getUnlocalizedName() );
|
||||
AELog.error( " block: " + blk.getUnlocalizedName() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ public class RenderBlockCharger extends BaseBlockRender<BlockCharger, TileCharge
|
|||
}
|
||||
catch( final Exception err )
|
||||
{
|
||||
AELog.error( err );
|
||||
AELog.debug( err );
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
@ -165,7 +165,7 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU<BlockC
|
|||
}
|
||||
catch( final Exception e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
@ -318,7 +318,7 @@ public class RenderBlockInscriber extends BaseBlockRender<BlockInscriber, TileIn
|
|||
}
|
||||
catch( final Exception err )
|
||||
{
|
||||
AELog.error( err );
|
||||
AELog.debug( err );
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
|
|
@ -146,7 +146,7 @@ public abstract class AEBaseContainer extends Container
|
|||
final GuiSync annotation = f.getAnnotation( GuiSync.class );
|
||||
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
|
||||
{
|
||||
|
@ -208,7 +208,7 @@ public abstract class AEBaseContainer extends Container
|
|||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
|
||||
this.dataChunks.clear();
|
||||
|
@ -270,7 +270,7 @@ public abstract class AEBaseContainer extends Container
|
|||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1109,7 +1109,7 @@ public abstract class AEBaseContainer extends Container
|
|||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1178,7 +1178,7 @@ public abstract class AEBaseContainer extends Container
|
|||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,15 +70,15 @@ public class SyncData
|
|||
}
|
||||
catch( final IllegalArgumentException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
catch( final IllegalAccessException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,11 +127,11 @@ public class SyncData
|
|||
}
|
||||
catch( final IllegalArgumentException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
catch( final IllegalAccessException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,11 +143,11 @@ public class SyncData
|
|||
}
|
||||
catch( final IllegalArgumentException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
catch( final IllegalAccessException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,11 +199,11 @@ public class SyncData
|
|||
}
|
||||
catch( final IllegalArgumentException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
catch( final IllegalAccessException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -280,7 +280,7 @@ public class ContainerCraftConfirm extends AEBaseContainer
|
|||
catch( final Throwable e )
|
||||
{
|
||||
this.getPlayerInv().player.addChatMessage( new ChatComponentText( "Error: " + e.toString() ) );
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
this.setValidContainer( false );
|
||||
this.result = null;
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
|||
}
|
||||
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 )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
|||
}
|
||||
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 )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,93 +19,374 @@
|
|||
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.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
/**
|
||||
* Utility class for easier logging.
|
||||
*/
|
||||
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()
|
||||
{
|
||||
}
|
||||
|
||||
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 ) )
|
||||
{
|
||||
error( exception );
|
||||
}
|
||||
log( Level.INFO, format, params );
|
||||
}
|
||||
|
||||
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 ) )
|
||||
{
|
||||
severe( "Error: " + e.getClass().getName() + " : " + e.getMessage() );
|
||||
e.printStackTrace();
|
||||
}
|
||||
log( Level.INFO, exception, DEFAULT_EXCEPTION_MESSAGE );
|
||||
}
|
||||
|
||||
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 ) )
|
||||
{
|
||||
info( aeBaseTile.getClass().getName() + " @ " + xCoord + ", " + yCoord + ", " + zCoord );
|
||||
}
|
||||
log( Level.WARN, format, params );
|
||||
}
|
||||
|
||||
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.INFO, format, data );
|
||||
}
|
||||
log( Level.WARN, exception, message );
|
||||
}
|
||||
|
||||
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 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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,8 +95,8 @@ public class IMCHandler
|
|||
}
|
||||
catch( final Exception t )
|
||||
{
|
||||
AELog.warning( "Problem detected when processing IMC " + key + " from " + message.getSender() );
|
||||
AELog.error( t );
|
||||
AELog.warn( "Problem detected when processing IMC " + key + " from " + message.getSender() );
|
||||
AELog.debug( t );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,12 +100,12 @@ public class RecipeLoader implements Runnable
|
|||
// on failure use jar parsing
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
this.handler.parseRecipes( new JarLoader( ASSETS_RECIPE_PATH ), "index.recipe" );
|
||||
}
|
||||
catch( final URISyntaxException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
this.handler.parseRecipes( new JarLoader( ASSETS_RECIPE_PATH ), "index.recipe" );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ public class ApiPart implements IPartHelper
|
|||
}
|
||||
catch( final ClassNotFoundException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
Class myCLass;
|
||||
|
||||
|
@ -134,8 +134,8 @@ public class ApiPart implements IPartHelper
|
|||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
AELog.warning( "Error loading " + name );
|
||||
AELog.error( t );
|
||||
AELog.warn( "Error loading " + name );
|
||||
AELog.debug( t );
|
||||
// throw new RuntimeException( t );
|
||||
}
|
||||
f = myCLass.getName();
|
||||
|
@ -164,7 +164,7 @@ public class ApiPart implements IPartHelper
|
|||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
AELog.error( t );
|
||||
AELog.debug( t );
|
||||
}
|
||||
|
||||
for( final MethodNode mn : n.methods )
|
||||
|
@ -197,13 +197,13 @@ public class ApiPart implements IPartHelper
|
|||
if( !rootC.isInstance( fish ) )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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." ) )
|
||||
|
@ -211,13 +211,13 @@ public class ApiPart implements IPartHelper
|
|||
if( !( fish instanceof TileCableBus ) )
|
||||
{
|
||||
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 ) )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
AELog.severe( "Layer: " + n.name + " Failed." );
|
||||
AELog.error( t );
|
||||
AELog.error( "Layer: " + n.name + " Failed." );
|
||||
AELog.debug( t );
|
||||
}
|
||||
|
||||
this.roots.put( fullPath, clazz );
|
||||
|
@ -297,7 +297,7 @@ public class ApiPart implements IPartHelper
|
|||
}
|
||||
catch( final Exception e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
throw new IllegalStateException( "Unable to manage part API.", e );
|
||||
}
|
||||
return clazz;
|
||||
|
|
|
@ -61,22 +61,22 @@ public final class GridCacheRegistry implements IGridCacheRegistry
|
|||
}
|
||||
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 );
|
||||
}
|
||||
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 );
|
||||
}
|
||||
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 );
|
||||
}
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,8 +72,8 @@ public class RecipeHandlerRegistry implements IRecipeHandlerRegistry
|
|||
}
|
||||
catch( final Throwable e )
|
||||
{
|
||||
AELog.severe( "Error Caused when trying to construct " + clz.getName() );
|
||||
AELog.error( e );
|
||||
AELog.error( "Error Caused when trying to construct " + clz.getName() );
|
||||
AELog.debug( e );
|
||||
|
||||
this.handlers.put( name, null ); // clear it..
|
||||
|
||||
|
@ -101,7 +101,7 @@ public class RecipeHandlerRegistry implements IRecipeHandlerRegistry
|
|||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
AELog.error( t );
|
||||
AELog.debug( t );
|
||||
}
|
||||
|
||||
if( rr != null )
|
||||
|
|
|
@ -51,19 +51,19 @@ public class AppEngClientPacketHandler extends AppEngPacketHandlerBase implement
|
|||
}
|
||||
catch( final InstantiationException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
catch( final IllegalAccessException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
catch( final IllegalArgumentException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( 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 )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
catch( final IllegalAccessException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
catch( final IllegalArgumentException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
catch( final InvocationTargetException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ public class PacketCraftRequest extends AppEngPacket
|
|||
{
|
||||
futureJob.cancel( true );
|
||||
}
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -186,7 +186,7 @@ public class PacketMEInventoryUpdate extends AppEngPacket
|
|||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -33,7 +33,6 @@ import net.minecraftforge.common.config.ConfigCategory;
|
|||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.CommonHelper;
|
||||
|
||||
|
||||
|
@ -64,7 +63,7 @@ final class PlayerData implements IWorldPlayerData, IOnWorldStartable, IOnWorldS
|
|||
this.config = configFile;
|
||||
|
||||
final ConfigCategory playerList = this.config.getCategory( "players" );
|
||||
this.playerMapping = new PlayerMapping( playerList, AELog.INSTANCE );
|
||||
this.playerMapping = new PlayerMapping( playerList );
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
|
@ -29,8 +29,6 @@ import com.google.common.base.Preconditions;
|
|||
|
||||
import net.minecraftforge.common.config.ConfigCategory;
|
||||
|
||||
import cpw.mods.fml.relauncher.FMLRelaunchLog;
|
||||
|
||||
|
||||
/**
|
||||
* Wrapper class for the player mappings.
|
||||
|
@ -46,9 +44,9 @@ final class PlayerMapping implements IWorldPlayerMapping
|
|||
*/
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -26,8 +26,6 @@ import java.util.UUID;
|
|||
import net.minecraftforge.common.config.ConfigCategory;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
|
||||
import cpw.mods.fml.relauncher.FMLRelaunchLog;
|
||||
|
||||
import appeng.core.AELog;
|
||||
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 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
|
||||
final UUIDMatcher matcher = new UUIDMatcher();
|
||||
|
@ -78,7 +76,7 @@ class PlayerMappingsInitializer
|
|||
}
|
||||
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 )
|
||||
{
|
||||
data = new NBTTagCompound();
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -165,7 +165,7 @@ final class SpawnData implements IWorldSpawnData
|
|||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ final class SpawnData implements IWorldSpawnData
|
|||
}
|
||||
catch( final Throwable e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -208,7 +208,7 @@ final class SpawnData implements IWorldSpawnData
|
|||
}
|
||||
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 )
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -24,26 +24,35 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
import com.google.common.base.Stopwatch;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
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.ICraftingGrid;
|
||||
import appeng.api.networking.crafting.ICraftingJob;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
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.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.core.AELog;
|
||||
import appeng.hooks.TickHandler;
|
||||
|
||||
|
||||
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 World world;
|
||||
|
@ -145,7 +154,7 @@ public class CraftingJob implements Runnable, ICraftingJob
|
|||
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 )
|
||||
// craftingInventory.moveItemsToStorage( storage );
|
||||
}
|
||||
|
@ -171,15 +180,15 @@ public class CraftingJob implements Runnable, ICraftingJob
|
|||
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 )
|
||||
{
|
||||
AELog.error( e1 );
|
||||
AELog.debug( e1 );
|
||||
}
|
||||
catch( final CraftingCalculationFailure f )
|
||||
{
|
||||
AELog.error( f );
|
||||
AELog.debug( f );
|
||||
}
|
||||
catch( final InterruptedException e1 )
|
||||
{
|
||||
|
@ -190,7 +199,7 @@ public class CraftingJob implements Runnable, ICraftingJob
|
|||
}
|
||||
catch( final CraftingCalculationFailure f )
|
||||
{
|
||||
AELog.error( f );
|
||||
AELog.debug( f );
|
||||
}
|
||||
catch( final InterruptedException e1 )
|
||||
{
|
||||
|
@ -199,7 +208,7 @@ public class CraftingJob implements Runnable, ICraftingJob
|
|||
return;
|
||||
}
|
||||
|
||||
this.log( "crafting job now done" );
|
||||
AELog.craftingDebug( "crafting job now done" );
|
||||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
|
@ -227,14 +236,14 @@ public class CraftingJob implements Runnable, ICraftingJob
|
|||
|
||||
if( !this.running )
|
||||
{
|
||||
this.log( "crafting job will now sleep" );
|
||||
AELog.craftingDebug( "crafting job will now sleep" );
|
||||
|
||||
while( !this.running )
|
||||
{
|
||||
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
|
||||
public boolean isSimulation()
|
||||
{
|
||||
|
@ -327,7 +331,7 @@ public class CraftingJob implements Runnable, ICraftingJob
|
|||
this.watch.start();
|
||||
this.running = true;
|
||||
|
||||
this.log( "main thread is now going to sleep" );
|
||||
AELog.craftingDebug( "main thread is now going to sleep" );
|
||||
|
||||
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;
|
||||
|
@ -363,9 +367,41 @@ public class CraftingJob implements Runnable, ICraftingJob
|
|||
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 final long perOp = 0;
|
||||
private final long times = 0;
|
||||
}
|
||||
|
|
|
@ -339,7 +339,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
|||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
AELog.error( t );
|
||||
AELog.debug( t );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -259,7 +259,7 @@ public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IMask
|
|||
}
|
||||
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 )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -289,7 +289,7 @@ public class TickHandler
|
|||
}
|
||||
catch( final Exception e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -119,11 +119,11 @@ public class BuildCraftBuilder implements IIntegrationModule
|
|||
}
|
||||
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 )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
AELog.error( t );
|
||||
AELog.debug( t );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -211,8 +211,8 @@ public class FMP implements IIntegrationModule, IPartFactory, IPartConverter, IF
|
|||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
AELog.severe( "Failed to register " + layerInterface.getName() + " with FMP, some features may not work with MultiParts." );
|
||||
AELog.error( t );
|
||||
AELog.error( "Failed to register " + layerInterface.getName() + " with FMP, some features may not work with MultiParts." );
|
||||
AELog.debug( t );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ public class ImmibisMicroblocks implements IImmibisMicroblocks, IIntegrationModu
|
|||
}
|
||||
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 )
|
||||
{
|
||||
AELog.error( err );
|
||||
AELog.debug( err );
|
||||
}
|
||||
|
||||
if( pos != null && type != null && type.getItem() instanceof ItemPaintBall )
|
||||
|
@ -385,7 +385,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
|||
}
|
||||
catch( final Exception err )
|
||||
{
|
||||
AELog.error( err );
|
||||
AELog.debug( err );
|
||||
}
|
||||
|
||||
if( pos != null )
|
||||
|
|
|
@ -110,7 +110,7 @@ public class GridStorage implements IGridStorage
|
|||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
|
||||
return "";
|
||||
|
|
|
@ -184,10 +184,10 @@ public class NetworkEventBus
|
|||
}
|
||||
catch( final Throwable e1 )
|
||||
{
|
||||
AELog.severe( "[AppEng] Network Event caused exception:" );
|
||||
AELog.severe( "Offending Class: " + obj.getClass().getName() );
|
||||
AELog.severe( "Offending Object: " + obj.toString() );
|
||||
AELog.error( e1 );
|
||||
AELog.error( "[AppEng] Network Event caused exception:" );
|
||||
AELog.error( "Offending Class: " + obj.getClass().getName() );
|
||||
AELog.error( "Offending Object: " + obj.toString() );
|
||||
AELog.debug( e1 );
|
||||
throw new IllegalStateException( e1 );
|
||||
}
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ public abstract class MBCalculator
|
|||
}
|
||||
catch( final Throwable err )
|
||||
{
|
||||
AELog.error( err );
|
||||
AELog.debug( err );
|
||||
}
|
||||
|
||||
this.disconnect();
|
||||
|
|
|
@ -83,6 +83,8 @@ import appeng.util.item.AEItemStack;
|
|||
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 max;
|
||||
private final int[] usedOps = new int[3];
|
||||
|
@ -427,12 +429,19 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
|||
( (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.startItemCount = 0;
|
||||
this.lastTime = 0;
|
||||
this.elapsedTime = 0;
|
||||
this.isComplete = true;
|
||||
|
||||
}
|
||||
|
||||
private void updateCPU()
|
||||
|
|
|
@ -1074,7 +1074,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
|||
}
|
||||
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 )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
|
||||
return items;
|
||||
|
|
|
@ -194,7 +194,7 @@ public final class PartP2POpenComputers extends PartP2PTunnel<PartP2POpenCompute
|
|||
}
|
||||
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 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 )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -370,7 +370,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
|
|||
}
|
||||
catch( final Exception e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
@ -257,10 +257,10 @@ public class RecipeHandler implements IRecipeHandler
|
|||
}
|
||||
catch( final Exception err )
|
||||
{
|
||||
AELog.warning( "Error Loading Recipe File:" + path );
|
||||
AELog.warn( "Error Loading Recipe File:" + path );
|
||||
if( this.data.exceptions )
|
||||
{
|
||||
AELog.error( err );
|
||||
AELog.debug( err );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ public class RecipeHandler implements IRecipeHandler
|
|||
}
|
||||
catch( final Throwable e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
if( this.data.crash )
|
||||
{
|
||||
throw new IllegalStateException( e );
|
||||
|
@ -398,10 +398,10 @@ public class RecipeHandler implements IRecipeHandler
|
|||
}
|
||||
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 )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
if( this.data.crash )
|
||||
{
|
||||
|
@ -412,10 +412,10 @@ public class RecipeHandler implements IRecipeHandler
|
|||
{
|
||||
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 )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
if( this.data.crash )
|
||||
{
|
||||
|
@ -429,7 +429,7 @@ public class RecipeHandler implements IRecipeHandler
|
|||
{
|
||||
if( this.data.exceptions )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
if( this.data.crash )
|
||||
{
|
||||
|
@ -505,11 +505,11 @@ public class RecipeHandler implements IRecipeHandler
|
|||
}
|
||||
catch( final FileNotFoundException e1 )
|
||||
{
|
||||
AELog.error( e1 );
|
||||
AELog.debug( e1 );
|
||||
}
|
||||
catch( final IOException e1 )
|
||||
{
|
||||
AELog.error( e1 );
|
||||
AELog.debug( e1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -529,7 +529,7 @@ public class RecipeHandler implements IRecipeHandler
|
|||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
AELog.error( t );
|
||||
AELog.debug( t );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -678,10 +678,10 @@ public class RecipeHandler implements IRecipeHandler
|
|||
}
|
||||
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 )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
if( this.data.crash )
|
||||
{
|
||||
|
|
|
@ -118,7 +118,7 @@ public class Shaped implements ICraftHandler, IWebsiteSerializer
|
|||
}
|
||||
catch( final Throwable e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
throw new RegistrationError( "Error while adding shaped recipe." );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ public class Shapeless implements ICraftHandler, IWebsiteSerializer
|
|||
}
|
||||
catch( final Throwable e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
throw new RegistrationError( "Error while adding shapeless recipe." );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ public class OreDictionaryHandler
|
|||
}
|
||||
catch( final Throwable e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ public final class VersionChecker implements Runnable
|
|||
catch( Exception exception )
|
||||
{
|
||||
// Log any unhandled exception to prevent the JVM from reporting them as unhandled.
|
||||
AELog.error( exception );
|
||||
AELog.debug( exception );
|
||||
}
|
||||
|
||||
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 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)
|
||||
* @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 );
|
||||
|
||||
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;
|
||||
writer.write( header );
|
||||
|
@ -116,8 +117,8 @@ final class MinecraftItemCSVExporter implements Exporter
|
|||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.warning( EXPORT_UNSUCCESSFUL_MESSAGE );
|
||||
AELog.error( e );
|
||||
AELog.warn( EXPORT_UNSUCCESSFUL_MESSAGE );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,7 +187,6 @@ final class MinecraftItemCSVExporter implements Exporter
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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 EXPORTING_NOTHING_MESSAGE = "Exporting nothing";
|
||||
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
|
||||
private final FMLControlledNamespacedRegistry<Item> itemRegistry;
|
||||
|
@ -243,7 +244,8 @@ final class MinecraftItemCSVExporter implements Exporter
|
|||
}
|
||||
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
|
||||
return null;
|
||||
|
|
|
@ -67,7 +67,7 @@ public final class ModVersionFetcher implements VersionFetcher
|
|||
}
|
||||
catch( final VersionCheckerException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
|
||||
return EXCEPTIONAL_VERSION;
|
||||
}
|
||||
|
|
|
@ -75,15 +75,15 @@ public final class ReleaseFetcher
|
|||
}
|
||||
catch( final VersionCheckerException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
catch( MalformedURLException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
catch( IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
|
||||
return EXCEPTIONAL_RELEASE;
|
||||
|
|
|
@ -178,7 +178,7 @@ public class CachedPlane
|
|||
}
|
||||
catch( final Exception e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ public class CachedPlane
|
|||
}
|
||||
catch( final Throwable e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
|
||||
// attempt recovery...
|
||||
te.setWorldObj( this.getWorld() );
|
||||
|
@ -319,7 +319,7 @@ public class CachedPlane
|
|||
}
|
||||
catch( final Throwable e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -199,7 +199,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
|||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
AELog.error( t );
|
||||
AELog.debug( t );
|
||||
}
|
||||
|
||||
stream.capacity( stream.readableBytes() );
|
||||
|
@ -279,7 +279,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
|||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
AELog.error( t );
|
||||
AELog.debug( t );
|
||||
}
|
||||
|
||||
return output;
|
||||
|
@ -319,7 +319,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
|||
}
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
|
|||
}
|
||||
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 )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ public class ClassInstantiation<T>
|
|||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
AELog.error( t );
|
||||
AELog.debug( t );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ public final class ConfigManager implements IConfigManager
|
|||
}
|
||||
catch( final IllegalArgumentException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -576,8 +576,8 @@ public class Platform
|
|||
}
|
||||
catch( final Throwable z )
|
||||
{
|
||||
AELog.error( t );
|
||||
AELog.error( z );
|
||||
AELog.debug( t );
|
||||
AELog.debug( z );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -589,7 +589,7 @@ public class Platform
|
|||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
AELog.error( t );
|
||||
AELog.debug( t );
|
||||
}
|
||||
|
||||
return new ArrayList<NBTBase>();
|
||||
|
@ -2010,7 +2010,7 @@ public class Platform
|
|||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
AELog.error( t );
|
||||
AELog.debug( t );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue