001: package com.protomatter.syslog;
002:
003: /**
004: * {{{ The Protomatter Software License, Version 1.0
005: * derived from The Apache Software License, Version 1.1
006: *
007: * Copyright (c) 1998-2002 Nate Sammons. All rights reserved.
008: *
009: * Redistribution and use in source and binary forms, with or without
010: * modification, are permitted provided that the following conditions
011: * are met:
012: *
013: * 1. Redistributions of source code must retain the above copyright
014: * notice, this list of conditions and the following disclaimer.
015: *
016: * 2. Redistributions in binary form must reproduce the above copyright
017: * notice, this list of conditions and the following disclaimer in
018: * the documentation and/or other materials provided with the
019: * distribution.
020: *
021: * 3. The end-user documentation included with the redistribution,
022: * if any, must include the following acknowledgment:
023: * "This product includes software developed for the
024: * Protomatter Software Project
025: * (http://protomatter.sourceforge.net/)."
026: * Alternately, this acknowledgment may appear in the software itself,
027: * if and wherever such third-party acknowledgments normally appear.
028: *
029: * 4. The names "Protomatter" and "Protomatter Software Project" must
030: * not be used to endorse or promote products derived from this
031: * software without prior written permission. For written
032: * permission, please contact support@protomatter.com.
033: *
034: * 5. Products derived from this software may not be called "Protomatter",
035: * nor may "Protomatter" appear in their name, without prior written
036: * permission of the Protomatter Software Project
037: * (support@protomatter.com).
038: *
039: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
040: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
041: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
042: * DISCLAIMED. IN NO EVENT SHALL THE PROTOMATTER SOFTWARE PROJECT OR
043: * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
044: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
045: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
046: * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
047: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
048: * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
049: * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
050: * SUCH DAMAGE. }}}
051: */
052:
053: import java.net.*;
054: import java.util.*;
055:
056: /**
057: * An interface for objects that will log things using the Syslog facility.
058: */
059: public interface Syslogger {
060: /**
061: * Log an entry to the log.
062: */
063: public void log(SyslogMessage message);
064:
065: /**
066: * Set the name of this logger.
067: */
068: public void setName(String name);
069:
070: /**
071: * Get the name of this logger.
072: */
073: public String getName();
074:
075: /**
076: * Shutdown this logger. The implementation should clean up
077: * any resources it has allocated, etc. After this method
078: * is called, no more log messages will be sent to this logger.
079: * However, if the logger receives messages after the
080: * <tt>shutdown()</tt> method is called, it can assume that
081: * logging has resumed. This method is called after the
082: * "master switch" inside Syslog has been flipped to "off"
083: * in the <tt>Syslog.shutdown()</tt> method.
084: */
085: public void shutdown();
086:
087: /**
088: * Determine if it's likely that a message at the
089: * given level on the given channel(s) will be logged.
090: * This covers about 99% of the cases where people
091: * need to use the <TT>Syslog.canXXX()</TT> methods.
092: * It's still possible that this method would return
093: * true even though the logger would ignore the message
094: * for some other reason. You can't please all the
095: * people all the time.
096: */
097: public boolean mightLog(Object logger, int level, String channel);
098:
099: /**
100: * Set the log policy used by this logger.
101: */
102: public void setPolicy(LogPolicy policy);
103:
104: /**
105: * Get the log policy used by this logger.
106: */
107: public LogPolicy getPolicy();
108:
109: /**
110: * Set the log formatter object used by this logger.
111: */
112: public void setTextFormatter(SyslogTextFormatter formatter);
113:
114: /**
115: * Get the log formatter object used by this logger.
116: */
117: public SyslogTextFormatter getTextFormatter();
118:
119: /**
120: * Flush the given logger's output.
121: */
122: public void flush();
123: }
|