View Javadoc

1   package org.apache.maven.doxia.logging;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  /**
23   * This interface supplies the API for providing feedback to the user from
24   * a Parser or Sink, using standard <code>Doxia</code> channels.
25   * <br/>
26   * There should be no big surprises here, although you may notice that the methods accept
27   * <code>java.lang.CharSequence</code> rather than <code>java.lang.String</code>. This is provided mainly as a
28   * convenience, to enable developers to pass things like <code>java.lang.StringBuffer</code> directly into the logger,
29   * rather than formatting first by calling <code>toString()</code>.
30   * <br/>
31   * Based on <code>org.apache.maven.plugin.logging.Log</code>.
32   *
33   * @author jdcasey
34   * @author ltheussl
35   * @version $Id: Log.java 785531 2009-06-17 09:47:59Z ltheussl $
36   * @since 1.1
37   */
38  public interface Log
39  {
40      /** Typecode for debugging messages. */
41      int LEVEL_DEBUG = 0;
42  
43      /** Typecode for informational messages. */
44      int LEVEL_INFO = 1;
45  
46      /** Typecode for warning messages. */
47      int LEVEL_WARN = 2;
48  
49      /** Typecode for error messages. */
50      int LEVEL_ERROR = 3;
51  
52      /** Typecode for fatal error messages. */
53      int LEVEL_FATAL = 4;
54  
55      /** Typecode for disabled log levels. */
56      int LEVEL_DISABLED = 5;
57  
58      /**
59       * Set the current log level.
60       *
61       * @param level the log level to set.
62       */
63      void setLogLevel( int level );
64  
65      /**
66       * <p>isDebugEnabled.</p>
67       *
68       * @return true if the <b>debug</b> error level is enabled.
69       */
70      boolean isDebugEnabled();
71  
72      /**
73       * Send a message to the user in the <b>debug</b> error level.
74       *
75       * @param content the message to log.
76       */
77      void debug( CharSequence content );
78  
79      /**
80       * Send a message (and accompanying exception) to the user in the <b>debug</b> error level.
81       * <br/>
82       * The error's stacktrace will be output when this error level is enabled.
83       *
84       * @param content the message to log.
85       * @param error the error to log.
86       */
87      void debug( CharSequence content, Throwable error );
88  
89      /**
90       * Send an exception to the user in the <b>debug</b> error level.
91       * <br/>
92       * The stack trace for this exception will be output when this error level is enabled.
93       *
94       * @param error the error to log.
95       */
96      void debug( Throwable error );
97  
98      /**
99       * <p>isInfoEnabled.</p>
100      *
101      * @return true if the <b>info</b> error level is enabled.
102      */
103     boolean isInfoEnabled();
104 
105     /**
106      * Send a message to the user in the <b>info</b> error level.
107      *
108      * @param content the message to log.
109      */
110     void info( CharSequence content );
111 
112     /**
113      * Send a message (and accompanying exception) to the user in the <b>info</b> error level.
114      * <br/>
115      * The error's stacktrace will be output when this error level is enabled.
116      *
117      * @param content the message to log.
118      * @param error the error to log.
119      */
120     void info( CharSequence content, Throwable error );
121 
122     /**
123      * Send an exception to the user in the <b>info</b> error level.
124      * <br/>
125      * The stack trace for this exception will be output when this error level is enabled.
126      *
127      * @param error the error to log.
128      */
129     void info( Throwable error );
130 
131     /**
132      * <p>isWarnEnabled.</p>
133      *
134      * @return true if the <b>warn</b> error level is enabled.
135      */
136     boolean isWarnEnabled();
137 
138     /**
139      * Send a message to the user in the <b>warn</b> error level.
140      *
141      * @param content the message to log.
142      */
143     void warn( CharSequence content );
144 
145     /**
146      * Send a message (and accompanying exception) to the user in the <b>warn</b> error level.
147      * <br/>
148      * The error's stacktrace will be output when this error level is enabled.
149      *
150      * @param content the message to log.
151      * @param error the error to log.
152      */
153     void warn( CharSequence content, Throwable error );
154 
155     /**
156      * Send an exception to the user in the <b>warn</b> error level.
157      * <br/>
158      * The stack trace for this exception will be output when this error level is enabled.
159      *
160      * @param error the error to log.
161      */
162     void warn( Throwable error );
163 
164     /**
165      * <p>isErrorEnabled.</p>
166      *
167      * @return true if the <b>error</b> error level is enabled.
168      */
169     boolean isErrorEnabled();
170 
171     /**
172      * Send a message to the user in the <b>error</b> error level.
173      *
174      * @param content the message to log.
175      */
176     void error( CharSequence content );
177 
178     /**
179      * Send a message (and accompanying exception) to the user in the <b>error</b> error level.
180      * <br/>
181      * The error's stacktrace will be output when this error level is enabled.
182      *
183      * @param content the message to log.
184      * @param error the error to log.
185      */
186     void error( CharSequence content, Throwable error );
187 
188     /**
189      * Send an exception to the user in the <b>error</b> error level.
190      * <br/>
191      * The stack trace for this exception will be output when this error level is enabled.
192      *
193      * @param error the error to log.
194      */
195     void error( Throwable error );
196 }