org.codehaus.plexus.logging.AbstractLogEnabled Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of virtdata-lib-realer Show documentation
Show all versions of virtdata-lib-realer Show documentation
With inspiration from other libraries
package org.codehaus.plexus.logging;
import org.codehaus.plexus.logging.console.ConsoleLogger;
/**
* @author Jason van Zyl
* @author Trygve Laugstøl
* @version $Id: AbstractLogEnabled.java 1806 2005-05-16 12:11:32Z evenisse $
*/
public abstract class AbstractLogEnabled
implements LogEnabled
{
private Logger logger;
public void enableLogging( Logger logger )
{
this.logger = logger;
}
protected Logger getLogger()
{
return logger;
}
protected void setupLogger( Object component )
{
setupLogger( component, logger );
}
protected void setupLogger( Object component, String subCategory )
{
if ( subCategory == null )
{
throw new IllegalStateException( "Logging category must be defined." );
}
Logger logger = this.logger.getChildLogger( subCategory );
setupLogger( component, logger );
}
protected void setupLogger( Object component, Logger logger )
{
if ( component instanceof LogEnabled )
{
( (LogEnabled) component ).enableLogging( logger );
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy