KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > protomatter > syslog > Syslogger


1 package com.protomatter.syslog;
2
3 /**
4  * {{{ The Protomatter Software License, Version 1.0
5  * derived from The Apache Software License, Version 1.1
6  *
7  * Copyright (c) 1998-2002 Nate Sammons. All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * 1. Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  *
16  * 2. Redistributions in binary form must reproduce the above copyright
17  * notice, this list of conditions and the following disclaimer in
18  * the documentation and/or other materials provided with the
19  * distribution.
20  *
21  * 3. The end-user documentation included with the redistribution,
22  * if any, must include the following acknowledgment:
23  * "This product includes software developed for the
24  * Protomatter Software Project
25  * (http://protomatter.sourceforge.net/)."
26  * Alternately, this acknowledgment may appear in the software itself,
27  * if and wherever such third-party acknowledgments normally appear.
28  *
29  * 4. The names "Protomatter" and "Protomatter Software Project" must
30  * not be used to endorse or promote products derived from this
31  * software without prior written permission. For written
32  * permission, please contact support@protomatter.com.
33  *
34  * 5. Products derived from this software may not be called "Protomatter",
35  * nor may "Protomatter" appear in their name, without prior written
36  * permission of the Protomatter Software Project
37  * (support@protomatter.com).
38  *
39  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
40  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
41  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
42  * DISCLAIMED. IN NO EVENT SHALL THE PROTOMATTER SOFTWARE PROJECT OR
43  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
45  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
46  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
47  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
48  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
49  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
50  * SUCH DAMAGE. }}}
51  */

52
53 import java.net.*;
54 import java.util.*;
55
56 /**
57  * An interface for objects that will log things using the Syslog facility.
58  */

59 public interface Syslogger
60 {
61   /**
62    * Log an entry to the log.
63    */

64   public void log(SyslogMessage message);
65
66   /**
67    * Set the name of this logger.
68    */

69   public void setName(String JavaDoc name);
70
71   /**
72    * Get the name of this logger.
73    */

74   public String JavaDoc getName();
75
76   /**
77    * Shutdown this logger. The implementation should clean up
78    * any resources it has allocated, etc. After this method
79    * is called, no more log messages will be sent to this logger.
80    * However, if the logger receives messages after the
81    * <tt>shutdown()</tt> method is called, it can assume that
82    * logging has resumed. This method is called after the
83    * "master switch" inside Syslog has been flipped to "off"
84    * in the <tt>Syslog.shutdown()</tt> method.
85    */

86   public void shutdown();
87
88   /**
89    * Determine if it's likely that a message at the
90    * given level on the given channel(s) will be logged.
91    * This covers about 99% of the cases where people
92    * need to use the <TT>Syslog.canXXX()</TT> methods.
93    * It's still possible that this method would return
94    * true even though the logger would ignore the message
95    * for some other reason. You can't please all the
96    * people all the time.
97    */

98   public boolean mightLog(Object JavaDoc logger, int level, String JavaDoc channel);
99
100   /**
101    * Set the log policy used by this logger.
102    */

103   public void setPolicy(LogPolicy policy);
104
105   /**
106    * Get the log policy used by this logger.
107    */

108   public LogPolicy getPolicy();
109
110   /**
111    * Set the log formatter object used by this logger.
112    */

113   public void setTextFormatter(SyslogTextFormatter formatter);
114
115   /**
116    * Get the log formatter object used by this logger.
117    */

118   public SyslogTextFormatter getTextFormatter();
119
120   /**
121    * Flush the given logger's output.
122    */

123   public void flush();
124 }
125
Popular Tags