001: /*
002: * <copyright>
003: *
004: * Copyright 1997-2004 BBNT Solutions, LLC
005: * under sponsorship of the Defense Advanced Research Projects
006: * Agency (DARPA).
007: *
008: * You can redistribute this software and/or modify it under the
009: * terms of the Cougaar Open Source License as published on the
010: * Cougaar Open Source Website (www.cougaar.org).
011: *
012: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
013: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
014: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
015: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
016: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
017: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
018: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
019: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
020: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
021: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
022: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
023: *
024: * </copyright>
025: */
026:
027: package org.cougaar.util.log;
028:
029: import java.util.Enumeration;
030:
031: /**
032: * A controller for a single Logger, used to set the logging levels
033: * and output destinations (console, files, etc).
034: * <p>
035: * This API is a bit kludgy -- it needs to be refactored into
036: * a more "readable" API, including a refactoring of
037: * LogTarget. For now I'm more concerned with the Logger
038: * API, since it will be used by all developers, than this
039: * LoggerController API.
040: */
041: public interface LoggerController {
042:
043: /**
044: * Special "static" method to get a named logger-controller.
045: * <p>
046: * This should be moved to a different interface...
047: */
048: LoggerController getLoggerController(String name);
049:
050: /**
051: * Special "static" method to get the names of all loggers.
052: * <p>
053: * This should be moved to a different interface...
054: */
055: Enumeration getAllLoggerNames();
056:
057: /**
058: * Get the logging level.
059: *
060: * @return a Logger level constant (DEBUG, INFO, etc)
061: *
062: * @see Logger
063: */
064: int getLoggingLevel();
065:
066: /**
067: * Set the logging level.
068: *
069: * @param level Logger level constant (DEBUG, INFO, etc)
070: *
071: * @see Logger
072: */
073: void setLoggingLevel(int level);
074:
075: /**
076: * Get an array of all LogTargets for this logger.
077: *
078: * return an array of {@link LogTarget} representing all
079: * the various logging destinations.
080: */
081: LogTarget[] getLogTargets();
082:
083: /**
084: * Add a logging destination.
085: *
086: * @param outputType The LogTarget constant (CONSOLE, FILE, or STREAM).
087: * @param outputDevice The device associated with the particular output
088: * type being added. Null for Console, filename for FILE, the actual
089: * output stream object for STREAM.
090: *
091: */
092: void addLogTarget(int outputType, Object outputDevice);
093:
094: /**
095: * Add a console output type to this logger.
096: * <p>
097: * This is equivalent to:<pre/>
098: * addLogTarget(LogTarget.CONSOLE, null);</pre>
099: */
100: void addConsole();
101:
102: /**
103: * Remove a logging output type.
104: *
105: * @param outputType The LogTarget constant (CONSOLE, FILE, or STREAM) of
106: * logging output to be removed. See constants above.
107: * @param outputDevice The device associated with the particular output
108: * type being removed. Null for Console, filename for FILE, the actual
109: * output stream object for STREAM.
110: */
111: boolean removeLogTarget(int outputType, Object outputDevice);
112:
113: /**
114: * Remove a logging output type.
115: *
116: * This method is usually used in conjunction with
117: * {@link #getLogTargets()} to
118: * iterate through list to remove items.
119: *
120: * @param outputType The LogTarget constant (CONSOLE, FILE, or STREAM) of
121: * logging output to be removed. See constants above.
122: * @param deviceString - The device associated with the particular output
123: * type being removed. Null for Console, filename for FILE,
124: * the String identifier name associated with the output stream.
125: */
126: boolean removeLogTarget(int outputType, String deviceString);
127:
128: }
|