All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.codehaus.plexus.logging.AbstractLogEnabled Maven / Gradle / Ivy

Go to download

Statistical sampling library for use in virtdata libraries, based on apache commons math 4

There is a newer version: 5.17.0
Show newest version
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 - 2024 Weber Informatics LLC | Privacy Policy