View Javadoc
1   package org.apache.maven.cli.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  import java.io.PrintStream;
23  
24  import org.slf4j.Logger;
25  import org.slf4j.Marker;
26  
27  /**
28   * @since 3.1.0
29   */
30  public class Slf4jStdoutLogger
31      implements Logger
32  {
33      private static final String ERROR = "[ERROR] ";
34  
35      private PrintStream out = System.out;
36  
37      //
38      // These are the only methods we need in our primordial logger
39      //    
40      public void error( String msg )
41      {
42          out.print( ERROR );
43          out.println( msg );
44      }
45  
46      public void error( String msg, Throwable t )
47      {
48          error( msg );
49  
50          if ( null != t )
51          {
52              t.printStackTrace( out );
53          }        
54      }    
55  
56      //
57      // Don't need any of this
58      //    
59      public String getName()
60      {
61          return null;
62      }
63  
64      public boolean isTraceEnabled()
65      {
66          return false;
67      }
68  
69      public void trace( String msg )
70      {
71      }
72  
73      public void trace( String format, Object arg )
74      {
75      }
76  
77      public void trace( String format, Object arg1, Object arg2 )
78      {
79      }
80  
81      public void trace( String format, Object... arguments )
82      {
83      }
84  
85      public void trace( String msg, Throwable t )
86      {
87      }
88  
89      public boolean isTraceEnabled( Marker marker )
90      {
91          return false;
92      }
93  
94      public void trace( Marker marker, String msg )
95      {
96      }
97  
98      public void trace( Marker marker, String format, Object arg )
99      {
100     }
101 
102     public void trace( Marker marker, String format, Object arg1, Object arg2 )
103     {
104     }
105 
106     public void trace( Marker marker, String format, Object... argArray )
107     {
108     }
109 
110     public void trace( Marker marker, String msg, Throwable t )
111     {
112     }
113 
114     public boolean isDebugEnabled()
115     {
116         return false;
117     }
118 
119     public void debug( String msg )
120     {
121     }
122 
123     public void debug( String format, Object arg )
124     {
125     }
126 
127     public void debug( String format, Object arg1, Object arg2 )
128     {
129     }
130 
131     public void debug( String format, Object... arguments )
132     {
133     }
134 
135     public void debug( String msg, Throwable t )
136     {
137     }
138 
139     public boolean isDebugEnabled( Marker marker )
140     {
141         return false;
142     }
143 
144     public void debug( Marker marker, String msg )
145     {
146     }
147 
148     public void debug( Marker marker, String format, Object arg )
149     {
150     }
151 
152     public void debug( Marker marker, String format, Object arg1, Object arg2 )
153     {
154     }
155 
156     public void debug( Marker marker, String format, Object... arguments )
157     {
158     }
159 
160     public void debug( Marker marker, String msg, Throwable t )
161     {
162     }
163 
164     public boolean isInfoEnabled()
165     {
166         return false;
167     }
168 
169     public void info( String msg )
170     {
171     }
172 
173     public void info( String format, Object arg )
174     {
175     }
176 
177     public void info( String format, Object arg1, Object arg2 )
178     {
179     }
180 
181     public void info( String format, Object... arguments )
182     {
183     }
184 
185     public void info( String msg, Throwable t )
186     {
187     }
188 
189     public boolean isInfoEnabled( Marker marker )
190     {
191         return false;
192     }
193 
194     public void info( Marker marker, String msg )
195     {
196     }
197 
198     public void info( Marker marker, String format, Object arg )
199     {
200     }
201 
202     public void info( Marker marker, String format, Object arg1, Object arg2 )
203     {
204     }
205 
206     public void info( Marker marker, String format, Object... arguments )
207     {
208     }
209 
210     public void info( Marker marker, String msg, Throwable t )
211     {
212     }
213 
214     public boolean isWarnEnabled()
215     {
216         return false;
217     }
218 
219     public void warn( String msg )
220     {
221     }
222 
223     public void warn( String format, Object arg )
224     {
225     }
226 
227     public void warn( String format, Object... arguments )
228     {
229     }
230 
231     public void warn( String format, Object arg1, Object arg2 )
232     {
233     }
234 
235     public void warn( String msg, Throwable t )
236     {
237     }
238 
239     public boolean isWarnEnabled( Marker marker )
240     {
241         return false;
242     }
243 
244     public void warn( Marker marker, String msg )
245     {
246     }
247 
248     public void warn( Marker marker, String format, Object arg )
249     {
250     }
251 
252     public void warn( Marker marker, String format, Object arg1, Object arg2 )
253     {
254     }
255 
256     public void warn( Marker marker, String format, Object... arguments )
257     {
258     }
259 
260     public void warn( Marker marker, String msg, Throwable t )
261     {
262     }
263 
264     public boolean isErrorEnabled()
265     {
266         return false;
267     }
268 
269     public void error( String format, Object arg )
270     {
271     }
272 
273     public void error( String format, Object arg1, Object arg2 )
274     {
275     }
276 
277     public void error( String format, Object... arguments )
278     {
279     }
280 
281     public boolean isErrorEnabled( Marker marker )
282     {
283         return false;
284     }
285 
286     public void error( Marker marker, String msg )
287     {
288     }
289 
290     public void error( Marker marker, String format, Object arg )
291     {
292     }
293 
294     public void error( Marker marker, String format, Object arg1, Object arg2 )
295     {
296     }
297 
298     public void error( Marker marker, String format, Object... arguments )
299     {
300     }
301 
302     public void error( Marker marker, String msg, Throwable t )
303     {
304     }
305 
306 }