001 /*
002 * Copyright 2004 Stephen J. McConnell.
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
013 * implied.
014 *
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019 package net.dpml.logging;
020
021 /**
022 * Logger is a interface through which different logging solutions
023 * can be provided. Typical examples of logging implementations include
024 * java.util.logging.Logger or Ant's Project.log() function.
025 *
026 * @author <a href="http://www.dpml.net">Digital Product Meta Library</a>
027 * @version 1.0.0
028 */
029 public interface Logger
030 {
031 /**
032 * Return TRUE is debug level logging is enabled.
033 * @return the enabled state of debug logging
034 */
035 boolean isDebugEnabled();
036
037 /**
038 * Return TRUE is trace level logging is enabled.
039 * @return the enabled state of trace logging
040 */
041 boolean isTraceEnabled();
042
043 /**
044 * Return TRUE is info level logging is enabled.
045 * @return the enabled state of info logging
046 */
047 boolean isInfoEnabled();
048
049 /**
050 * Return TRUE is error level logging is enabled.
051 * @return the enabled state of error logging
052 */
053 boolean isErrorEnabled();
054
055 /**
056 * Return TRUE is error warning logging is enabled.
057 * @return the enabled state of warning logging
058 */
059 boolean isWarnEnabled();
060
061 /**
062 * Record a debug level message.
063 * @param message the debug message to record
064 */
065 void debug( String message );
066
067 /**
068 * Record a trace level message.
069 * @param message the trace message to record
070 */
071 void trace( String message );
072
073 /**
074 * Record a informative message.
075 * @param message the info message to record
076 */
077 void info( String message );
078
079 /**
080 * Record a warning message.
081 * @param message the warning message to record
082 */
083 void warn( String message );
084
085 /**
086 * Record a warning message.
087 * @param message the warning message to record
088 * @param cause the causal exception
089 */
090 void warn( String message, Throwable cause );
091
092 /**
093 * Record a error level message.
094 * @param message the error message to record
095 */
096 void error( String message );
097
098 /**
099 * Record a error level message.
100 * @param message the error message to record
101 * @param cause the causal exception
102 */
103 void error( String message, Throwable cause );
104
105 /**
106 * Return a child logger relative to the current logger.
107 * @param category the relative category name
108 * @return the child logging channel
109 */
110 Logger getChildLogger( String category );
111 }
112
113