Package org.jzonic.jlo.processor

Source Code of org.jzonic.jlo.processor.DirectLogProcessor

package org.jzonic.jlo.processor;


import org.jzonic.jlo.LogEvent;
import org.jzonic.jlo.LogGenerator;
import org.jzonic.jlo.LogRecord;
/**
*  The DirectLogProcessor is a concrete implementation of
*  the LogProcessor and handles all request immediately.
*
*@author  Andreas Mecky
*@author  Terry Dye
  */
public class DirectLogProcessor extends AbstractLogProcessor {
       
    /**
     *  Constructor for the DirectLogProcessor object
     */
    public DirectLogProcessor() {
    }
   
   
    /**
     * This method processes every log request. If the LogGenerator
     * is not NULL then it will try to get the Formatter from it.
     * If this formatter is not NULL it will call the formatMessage
     * method to format the message and then call the publish method
     * of the corresponding Handler. Otherwise it will only call the
     * publish method.
     *
     *@param  lg the LogGenerator    
     *@param  lr the LogRecord
     */
    public void processEvent(LogGenerator lg,LogRecord lr) {       
        LogEvent le = new LogEvent(lg.getHandler(), lg.getFormatter(), lr);
        handlePipes(le);
        if ( lg.getFilter() != null ) {
            if ( lg.getFilter().match(lr.getMessage() )) {
                handle(le);
            }
        }
        else {
            handle(le);       
        }
        handleSpecialChannels(lr);
    }
    
    /**
     * This method does nothing
     */
    public void flush() {
    }   
   
    public String getProcessorName() {
        return "DirectLogProcessor";
    }
   
}
TOP

Related Classes of org.jzonic.jlo.processor.DirectLogProcessor

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.