KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jzonic > jlo > processor > DirectLogProcessor


1 package org.jzonic.jlo.processor;
2
3
4 import org.jzonic.jlo.LogEvent;
5 import org.jzonic.jlo.LogGenerator;
6 import org.jzonic.jlo.LogRecord;
7 /**
8  * The DirectLogProcessor is a concrete implementation of
9  * the LogProcessor and handles all request immediately.
10  *
11  *@author Andreas Mecky
12  *@author Terry Dye
13   */

14 public class DirectLogProcessor extends AbstractLogProcessor {
15         
16     /**
17      * Constructor for the DirectLogProcessor object
18      */

19     public DirectLogProcessor() {
20     }
21     
22     
23     /**
24      * This method processes every log request. If the LogGenerator
25      * is not NULL then it will try to get the Formatter from it.
26      * If this formatter is not NULL it will call the formatMessage
27      * method to format the message and then call the publish method
28      * of the corresponding Handler. Otherwise it will only call the
29      * publish method.
30      *
31      *@param lg the LogGenerator
32      *@param lr the LogRecord
33      */

34     public void processEvent(LogGenerator lg,LogRecord lr) {
35         LogEvent le = new LogEvent(lg.getHandler(), lg.getFormatter(), lr);
36         handlePipes(le);
37         if ( lg.getFilter() != null ) {
38             if ( lg.getFilter().match(lr.getMessage() )) {
39                 handle(le);
40             }
41         }
42         else {
43             handle(le);
44         }
45         handleSpecialChannels(lr);
46     }
47      
48     /**
49      * This method does nothing
50      */

51     public void flush() {
52     }
53     
54     public String JavaDoc getProcessorName() {
55         return "DirectLogProcessor";
56     }
57     
58 }
59
Popular Tags