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.StringBuilder</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   * @since 1.1
36   */
37  public interface Log
38  {
39      /** Typecode for debugging messages. */
40      int LEVEL_DEBUG = 0;
41  
42      /** Typecode for informational messages. */
43      int LEVEL_INFO = 1;
44  
45      /** Typecode for warning messages. */
46      int LEVEL_WARN = 2;
47  
48      /** Typecode for error messages. */
49      int LEVEL_ERROR = 3;
50  
51      /** Typecode for fatal error messages. */
52      int LEVEL_FATAL = 4;
53  
54      /** Typecode for disabled log levels. */
55      int LEVEL_DISABLED = 5;
56  
57      /**
58       * Set the current log level.
59       *
60       * @param level the log level to set.
61       */
62      void setLogLevel( int level );
63  
64      /**
65       * <p>isDebugEnabled.</p>
66       *
67       * @return true if the <b>debug</b> error level is enabled.
68       */
69      boolean isDebugEnabled();
70  
71      /**
72       * Send a message to the user in the <b>debug</b> error level.
73       *
74       * @param content the message to log.
75       */
76      void debug( CharSequence content );
77  
78      /**
79       * Send a message (and accompanying exception) to the user in the <b>debug</b> error level.
80       * <br>
81       * The error's stacktrace will be output when this error level is enabled.
82       *
83       * @param content the message to log.
84       * @param error the error to log.
85       */
86      void debug( CharSequence content, Throwable error );
87  
88      /**
89       * Send an exception to the user in the <b>debug</b> error level.
90       * <br>
91       * The stack trace for this exception will be output when this error level is enabled.
92       *
93       * @param error the error to log.
94       */
95      void debug( Throwable error );
96  
97      /**
98       * <p>isInfoEnabled.</p>
99       *
100      * @return true if the <b>info</b> error level is enabled.
101      */
102     boolean isInfoEnabled();
103 
104     /**
105      * Send a message to the user in the <b>info</b> error level.
106      *
107      * @param content the message to log.
108      */
109     void info( CharSequence content );
110 
111     /**
112      * Send a message (and accompanying exception) to the user in the <b>info</b> error level.
113      * <br>
114      * The error's stacktrace will be output when this error level is enabled.
115      *
116      * @param content the message to log.
117      * @param error the error to log.
118      */
119     void info( CharSequence content, Throwable error );
120 
121     /**
122      * Send an exception to the user in the <b>info</b> error level.
123      * <br>
124      * The stack trace for this exception will be output when this error level is enabled.
125      *
126      * @param error the error to log.
127      */
128     void info( Throwable error );
129 
130     /**
131      * <p>isWarnEnabled.</p>
132      *
133      * @return true if the <b>warn</b> error level is enabled.
134      */
135     boolean isWarnEnabled();
136 
137     /**
138      * Send a message to the user in the <b>warn</b> error level.
139      *
140      * @param content the message to log.
141      */
142     void warn( CharSequence content );
143 
144     /**
145      * Send a message (and accompanying exception) to the user in the <b>warn</b> error level.
146      * <br>
147      * The error's stacktrace will be output when this error level is enabled.
148      *
149      * @param content the message to log.
150      * @param error the error to log.
151      */
152     void warn( CharSequence content, Throwable error );
153 
154     /**
155      * Send an exception to the user in the <b>warn</b> error level.
156      * <br>
157      * The stack trace for this exception will be output when this error level is enabled.
158      *
159      * @param error the error to log.
160      */
161     void warn( Throwable error );
162 
163     /**
164      * <p>isErrorEnabled.</p>
165      *
166      * @return true if the <b>error</b> error level is enabled.
167      */
168     boolean isErrorEnabled();
169 
170     /**
171      * Send a message to the user in the <b>error</b> error level.
172      *
173      * @param content the message to log.
174      */
175     void error( CharSequence content );
176 
177     /**
178      * Send a message (and accompanying exception) to the user in the <b>error</b> error level.
179      * <br>
180      * The error's stacktrace will be output when this error level is enabled.
181      *
182      * @param content the message to log.
183      * @param error the error to log.
184      */
185     void error( CharSequence content, Throwable error );
186 
187     /**
188      * Send an exception to the user in the <b>error</b> error level.
189      * <br>
190      * The stack trace for this exception will be output when this error level is enabled.
191      *
192      * @param error the error to log.
193      */
194     void error( Throwable error );
195 }