001: /*
002: * Copyright 2005 Joe Walker
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.directwebremoting.util;
017:
018: /**
019: * We don't want to force users to use commons-logging, but there are no
020: * logging APIs available at 1.3 so this lets us use Servlet.log if
021: * commons-logging is not available.
022: * @author Joe Walker [joe at getahead dot ltd dot uk]
023: */
024: public interface LoggingOutput {
025: /**
026: * Something has gone very badly wrong.
027: * Processing is likely to stop.
028: */
029: public static final int LEVEL_FATAL = 5;
030:
031: /**
032: * Something has gone wrong with the current request.
033: * The user will notice that we've broken something.
034: */
035: public static final int LEVEL_ERROR = 4;
036:
037: /**
038: * Something has gone wrong, but it could well be the users fault.
039: * No need to panic yet.
040: */
041: public static final int LEVEL_WARN = 3;
042:
043: /**
044: * An event happened that we might need to keep track of.
045: */
046: public static final int LEVEL_INFO = 2;
047:
048: /**
049: * Testing information.
050: */
051: public static final int LEVEL_DEBUG = 1;
052:
053: /**
054: * Logger a debug message
055: * @param message The text to log
056: */
057: public void debug(String message);
058:
059: /**
060: * Logger an info message
061: * @param message The text to log
062: */
063: public void info(String message);
064:
065: /**
066: * Logger a warning message
067: * @param message The text to log
068: */
069: public void warn(String message);
070:
071: /**
072: * Logger a warning message
073: * @param message The text to log
074: * @param th An optional stack trace
075: */
076: public void warn(String message, Throwable th);
077:
078: /**
079: * Logger an error message
080: * @param message The text to log
081: */
082: public void error(String message);
083:
084: /**
085: * Logger an error message
086: * @param message The text to log
087: * @param th An optional stack trace
088: */
089: public void error(String message, Throwable th);
090:
091: /**
092: * Logger a fatal error message
093: * @param message The text to log
094: */
095: public void fatal(String message);
096:
097: /**
098: * Logger a fatal error message
099: * @param message The text to log
100: * @param th An optional stack trace
101: */
102: public void fatal(String message, Throwable th);
103:
104: /**
105: * Save CPU time when we are not debugging
106: * @return true if debugging is enabled
107: */
108: public boolean isDebugEnabled();
109: }
|