View Javadoc

1   package org.apache.maven.shared.invoker;
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   * A logger used by {@link Invoker} instances to output diagnostic messages.
24   * 
25   * @see Invoker#setLogger(InvokerLogger)
26   * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
27   * @version $Id: InvokerLogger.java 662043 2008-05-31 16:27:02Z bentmann $
28   */
29  public interface InvokerLogger
30  {
31  
32      /**
33       * The threshold for debug output.
34       */
35      public static final int DEBUG = 4;
36  
37      /**
38       * The threshold for info output.
39       */
40      public static final int INFO = 3;
41  
42      /**
43       * The threshold for warn output.
44       */
45      public static final int WARN = 2;
46  
47      /**
48       * The threshold for error output.
49       */
50      public static final int ERROR = 1;
51  
52      /**
53       * The threshold for fatal error output.
54       */
55      public static final int FATAL = 0;
56  
57      /**
58       * Logs the specified debug message.
59       * 
60       * @param message The message to log, may be <code>null</code>.
61       */
62      void debug( String message );
63  
64      /**
65       * Logs the specified debug message and the accompanying exception.
66       * 
67       * @param message The message to log, may be <code>null</code>.
68       * @param throwable The exception to log, may be <code>null</code>.
69       */
70      void debug( String message, Throwable throwable );
71  
72      /**
73       * Tests whether debug output is enabled for this logger.
74       * 
75       * @return <code>true</code> if messages with priority "debug" or above are logged, <code>false</code>
76       *         otherwise.
77       */
78      boolean isDebugEnabled();
79  
80      /**
81       * Logs the specified info message.
82       * 
83       * @param message The message to log, may be <code>null</code>.
84       */
85      void info( String message );
86  
87      /**
88       * Logs the specified info message and the accompanying exception.
89       * 
90       * @param message The message to log, may be <code>null</code>.
91       * @param throwable The exception to log, may be <code>null</code>.
92       */
93      void info( String message, Throwable throwable );
94  
95      /**
96       * Tests whether info output is enabled for this logger.
97       * 
98       * @return <code>true</code> if messages with priority "info" or above are logged, <code>false</code> otherwise.
99       */
100     boolean isInfoEnabled();
101 
102     /**
103      * Logs the specified warning message.
104      * 
105      * @param message The message to log, may be <code>null</code>.
106      */
107     void warn( String message );
108 
109     /**
110      * Logs the specified warning message and the accompanying exception.
111      * 
112      * @param message The message to log, may be <code>null</code>.
113      * @param throwable The exception to log, may be <code>null</code>.
114      */
115     void warn( String message, Throwable throwable );
116 
117     /**
118      * Tests whether warn output is enabled for this logger.
119      * 
120      * @return <code>true</code> if messages with priority "warn" or above are logged, <code>false</code> otherwise.
121      */
122     boolean isWarnEnabled();
123 
124     /**
125      * Logs the specified error message.
126      * 
127      * @param message The message to log, may be <code>null</code>.
128      */
129     void error( String message );
130 
131     /**
132      * Logs the specified error message and the accompanying exception.
133      * 
134      * @param message The message to log, may be <code>null</code>.
135      * @param throwable The exception to log, may be <code>null</code>.
136      */
137     void error( String message, Throwable throwable );
138 
139     /**
140      * Tests whether error output is enabled for this logger.
141      * 
142      * @return <code>true</code> if messages with priority "error" or above are logged, <code>false</code>
143      *         otherwise.
144      */
145     boolean isErrorEnabled();
146 
147     /**
148      * Logs the specified fatal error message.
149      * 
150      * @param message The message to log, may be <code>null</code>.
151      */
152     void fatalError( String message );
153 
154     /**
155      * Logs the specified fatal error message and the accompanying exception.
156      * 
157      * @param message The message to log, may be <code>null</code>.
158      * @param throwable The exception to log, may be <code>null</code>.
159      */
160     void fatalError( String message, Throwable throwable );
161 
162     /**
163      * Tests whether fatal error output is enabled for this logger.
164      * 
165      * @return <code>true</code> if messages with priority "fatal" or above are logged, <code>false</code>
166      *         otherwise.
167      */
168     boolean isFatalErrorEnabled();
169 
170     /**
171      * Sets the logger's threshold.
172      * 
173      * @param threshold The logger's threshold, must be one of {@link #DEBUG}, {@link #INFO}, {@link #WARN},
174      *            {@link #ERROR} and {@link #FATAL}.
175      */
176     void setThreshold( int threshold );
177 
178     /**
179      * Gets the logger's threshold.
180      * 
181      * @return The logger's threshold, one of {@link #DEBUG}, {@link #INFO}, {@link #WARN}, {@link #ERROR} and
182      *         {@link #FATAL}.
183      */
184     int getThreshold();
185 
186 }