View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.plugin.logging;
20  
21  /**
22   * This interface supplies the API for providing feedback to the user from the <code>Mojo</code>, using standard
23   * <code>Maven</code> channels.<br>
24   * There should be no big surprises here, although you may notice that the methods accept
25   * <code>java.lang.CharSequence</code> rather than <code>java.lang.String</code>. This is provided mainly as a
26   * convenience, to enable developers to pass things like <code>java.lang.StringBuffer</code> directly into the logger,
27   * rather than formatting first by calling <code>toString()</code>.
28   *
29   * @author jdcasey
30   */
31  public interface Log {
32      /**
33       * @return true if the <b>debug</b> error level is enabled
34       */
35      boolean isDebugEnabled();
36  
37      /**
38       * Send a message to the user in the <b>debug</b> error level.
39       *
40       * @param content
41       */
42      void debug(CharSequence content);
43  
44      /**
45       * Send a message (and accompanying exception) to the user in the <b>debug</b> error level.<br>
46       * The error's stacktrace will be output when this error level is enabled.
47       *
48       * @param content
49       * @param error
50       */
51      void debug(CharSequence content, Throwable error);
52  
53      /**
54       * Send an exception to the user in the <b>debug</b> error level.<br>
55       * The stack trace for this exception will be output when this error level is enabled.
56       *
57       * @param error
58       */
59      void debug(Throwable error);
60  
61      /**
62       * @return true if the <b>info</b> error level is enabled
63       */
64      boolean isInfoEnabled();
65  
66      /**
67       * Send a message to the user in the <b>info</b> error level.
68       *
69       * @param content
70       */
71      void info(CharSequence content);
72  
73      /**
74       * Send a message (and accompanying exception) to the user in the <b>info</b> error level.<br>
75       * The error's stacktrace will be output when this error level is enabled.
76       *
77       * @param content
78       * @param error
79       */
80      void info(CharSequence content, Throwable error);
81  
82      /**
83       * Send an exception to the user in the <b>info</b> error level.<br>
84       * The stack trace for this exception will be output when this error level is enabled.
85       *
86       * @param error
87       */
88      void info(Throwable error);
89  
90      /**
91       * @return true if the <b>warn</b> error level is enabled
92       */
93      boolean isWarnEnabled();
94  
95      /**
96       * Send a message to the user in the <b>warn</b> error level.
97       *
98       * @param content
99       */
100     void warn(CharSequence content);
101 
102     /**
103      * Send a message (and accompanying exception) to the user in the <b>warn</b> error level.<br>
104      * The error's stacktrace will be output when this error level is enabled.
105      *
106      * @param content
107      * @param error
108      */
109     void warn(CharSequence content, Throwable error);
110 
111     /**
112      * Send an exception to the user in the <b>warn</b> error level.<br>
113      * The stack trace for this exception will be output when this error level is enabled.
114      *
115      * @param error
116      */
117     void warn(Throwable error);
118 
119     /**
120      * @return true if the <b>error</b> error level is enabled
121      */
122     boolean isErrorEnabled();
123 
124     /**
125      * Send a message to the user in the <b>error</b> error level.
126      *
127      * @param content
128      */
129     void error(CharSequence content);
130 
131     /**
132      * Send a message (and accompanying exception) to the user in the <b>error</b> error level.<br>
133      * The error's stacktrace will be output when this error level is enabled.
134      *
135      * @param content
136      * @param error
137      */
138     void error(CharSequence content, Throwable error);
139 
140     /**
141      * Send an exception to the user in the <b>error</b> error level.<br>
142      * The stack trace for this exception will be output when this error level is enabled.
143      *
144      * @param error
145      */
146     void error(Throwable error);
147 }