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: /** Standard implementation of all the busy-work of Logger
030: **/
031: public abstract class LoggerAdapter implements Logger {
032:
033: public abstract boolean isEnabledFor(int level);
034:
035: public abstract void log(int level, String message, Throwable t);
036:
037: public final void log(int level, String message) {
038: log(level, message, null);
039: }
040:
041: public final boolean isDetailEnabled() {
042: return isEnabledFor(DETAIL);
043: }
044:
045: public final boolean isDebugEnabled() {
046: return isEnabledFor(DEBUG);
047: }
048:
049: public final boolean isInfoEnabled() {
050: return isEnabledFor(INFO);
051: }
052:
053: public final boolean isWarnEnabled() {
054: return isEnabledFor(WARN);
055: }
056:
057: public final boolean isErrorEnabled() {
058: return isEnabledFor(ERROR);
059: }
060:
061: public final boolean isShoutEnabled() {
062: return isEnabledFor(SHOUT);
063: }
064:
065: public final boolean isFatalEnabled() {
066: return isEnabledFor(FATAL);
067: }
068:
069: public final void detail(String message) {
070: log(DETAIL, message, null);
071: }
072:
073: public final void detail(String message, Throwable t) {
074: log(DETAIL, message, t);
075: }
076:
077: public final void debug(String message) {
078: log(DEBUG, message, null);
079: }
080:
081: public final void debug(String message, Throwable t) {
082: log(DEBUG, message, t);
083: }
084:
085: public final void info(String message) {
086: log(INFO, message, null);
087: }
088:
089: public final void info(String message, Throwable t) {
090: log(INFO, message, t);
091: }
092:
093: public final void warn(String message) {
094: log(WARN, message, null);
095: }
096:
097: public final void warn(String message, Throwable t) {
098: log(WARN, message, t);
099: }
100:
101: public final void error(String message) {
102: log(ERROR, message, null);
103: }
104:
105: public final void error(String message, Throwable t) {
106: log(ERROR, message, t);
107: }
108:
109: public final void shout(String message) {
110: log(SHOUT, message, null);
111: }
112:
113: public final void shout(String message, Throwable t) {
114: log(SHOUT, message, t);
115: }
116:
117: public final void fatal(String message) {
118: log(FATAL, message, null);
119: }
120:
121: public final void fatal(String message, Throwable t) {
122: log(FATAL, message, t);
123: }
124: }
|