01: package org.jzonic.jlo.processor;
02:
03: import org.jzonic.jlo.LogEvent;
04: import org.jzonic.jlo.LogGenerator;
05: import org.jzonic.jlo.LogRecord;
06:
07: /**
08: * The DirectLogProcessor is a concrete implementation of
09: * 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: * This method processes every log request. If the LogGenerator
24: * is not NULL then it will try to get the Formatter from it.
25: * If this formatter is not NULL it will call the formatMessage
26: * method to format the message and then call the publish method
27: * of the corresponding Handler. Otherwise it will only call the
28: * publish method.
29: *
30: *@param lg the LogGenerator
31: *@param lr the LogRecord
32: */
33: public void processEvent(LogGenerator lg, LogRecord lr) {
34: LogEvent le = new LogEvent(lg.getHandler(), lg.getFormatter(),
35: lr);
36: handlePipes(le);
37: if (lg.getFilter() != null) {
38: if (lg.getFilter().match(lr.getMessage())) {
39: handle(le);
40: }
41: } else {
42: handle(le);
43: }
44: handleSpecialChannels(lr);
45: }
46:
47: /**
48: * This method does nothing
49: */
50: public void flush() {
51: }
52:
53: public String getProcessorName() {
54: return "DirectLogProcessor";
55: }
56:
57: }
|