01: /*
02: * <copyright>
03: *
04: * Copyright 1997-2004 BBNT Solutions, LLC
05: * under sponsorship of the Defense Advanced Research Projects
06: * Agency (DARPA).
07: *
08: * You can redistribute this software and/or modify it under the
09: * terms of the Cougaar Open Source License as published on the
10: * Cougaar Open Source Website (www.cougaar.org).
11: *
12: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
13: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
14: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
15: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
16: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
17: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
18: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23: *
24: * </copyright>
25: */
26:
27: package org.cougaar.util.log;
28:
29: import java.io.Serializable;
30:
31: /**
32: * Represents an output destination of a named logger.
33: * <p>
34: * Note that a single Logger instance can have multiple
35: * LogTargets.
36: */
37: public class LogTarget implements Serializable {
38:
39: /**
40: * Generic target type identifiers.
41: * <p>
42: * The value of these constants may be modified in the future
43: * without notice. For example, "CONSOLE" may be changed from
44: * "1" to "0".
45: */
46: public static final int CONSOLE = 1;
47: public static final int STREAM = 2;
48: public static final int FILE = 3;
49:
50: private final String name;
51: private final int outputType;
52: private final String outputDevice;
53: private final int loggingLevel;
54:
55: public LogTarget(String name, int outputType, String outputDevice,
56: int loggingLevel) {
57: this .name = name;
58: this .outputType = outputType;
59: this .outputDevice = outputDevice;
60: this .loggingLevel = loggingLevel;
61: }
62:
63: /**
64: * @return The name for this logger
65: */
66: public String getName() {
67: return name;
68: }
69:
70: /**
71: * @return a constant (CONSOLE, STREAM, or FILE)
72: */
73: public int getOutputType() {
74: return outputType;
75: }
76:
77: /**
78: * @return The device identifier (null for CONSOLE, filename for FILE,
79: * and stream-id for STREAM)
80: */
81: public String getOutputDevice() {
82: return outputDevice;
83: }
84:
85: /**
86: * @return a Logger constant for the logger's level (DEBUG, etc)
87: */
88: public int getLoggingLevel() {
89: return loggingLevel;
90: }
91:
92: public String toString() {
93: return "logger \"" + name + "\"";
94: }
95: }
|