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.cli.logging;
20  
21  import java.io.PrintStream;
22  
23  import org.slf4j.Logger;
24  import org.slf4j.Marker;
25  
26  /**
27   * @since 3.1.0
28   */
29  public class Slf4jStdoutLogger implements Logger {
30      private static final String ERROR = "[ERROR] ";
31  
32      private PrintStream out = System.out;
33  
34      //
35      // These are the only methods we need in our primordial logger
36      //
37      public void error(String msg) {
38          out.print(ERROR);
39          out.println(msg);
40      }
41  
42      public void error(String msg, Throwable t) {
43          error(msg);
44  
45          if (null != t) {
46              t.printStackTrace(out);
47          }
48      }
49  
50      //
51      // Don't need any of this
52      //
53      public String getName() {
54          return null;
55      }
56  
57      public boolean isTraceEnabled() {
58          return false;
59      }
60  
61      public void trace(String msg) {}
62  
63      public void trace(String format, Object arg) {}
64  
65      public void trace(String format, Object arg1, Object arg2) {}
66  
67      public void trace(String format, Object... arguments) {}
68  
69      public void trace(String msg, Throwable t) {}
70  
71      public boolean isTraceEnabled(Marker marker) {
72          return false;
73      }
74  
75      public void trace(Marker marker, String msg) {}
76  
77      public void trace(Marker marker, String format, Object arg) {}
78  
79      public void trace(Marker marker, String format, Object arg1, Object arg2) {}
80  
81      public void trace(Marker marker, String format, Object... argArray) {}
82  
83      public void trace(Marker marker, String msg, Throwable t) {}
84  
85      public boolean isDebugEnabled() {
86          return false;
87      }
88  
89      public void debug(String msg) {}
90  
91      public void debug(String format, Object arg) {}
92  
93      public void debug(String format, Object arg1, Object arg2) {}
94  
95      public void debug(String format, Object... arguments) {}
96  
97      public void debug(String msg, Throwable t) {}
98  
99      public boolean isDebugEnabled(Marker marker) {
100         return false;
101     }
102 
103     public void debug(Marker marker, String msg) {}
104 
105     public void debug(Marker marker, String format, Object arg) {}
106 
107     public void debug(Marker marker, String format, Object arg1, Object arg2) {}
108 
109     public void debug(Marker marker, String format, Object... arguments) {}
110 
111     public void debug(Marker marker, String msg, Throwable t) {}
112 
113     public boolean isInfoEnabled() {
114         return false;
115     }
116 
117     public void info(String msg) {}
118 
119     public void info(String format, Object arg) {}
120 
121     public void info(String format, Object arg1, Object arg2) {}
122 
123     public void info(String format, Object... arguments) {}
124 
125     public void info(String msg, Throwable t) {}
126 
127     public boolean isInfoEnabled(Marker marker) {
128         return false;
129     }
130 
131     public void info(Marker marker, String msg) {}
132 
133     public void info(Marker marker, String format, Object arg) {}
134 
135     public void info(Marker marker, String format, Object arg1, Object arg2) {}
136 
137     public void info(Marker marker, String format, Object... arguments) {}
138 
139     public void info(Marker marker, String msg, Throwable t) {}
140 
141     public boolean isWarnEnabled() {
142         return false;
143     }
144 
145     public void warn(String msg) {}
146 
147     public void warn(String format, Object arg) {}
148 
149     public void warn(String format, Object... arguments) {}
150 
151     public void warn(String format, Object arg1, Object arg2) {}
152 
153     public void warn(String msg, Throwable t) {}
154 
155     public boolean isWarnEnabled(Marker marker) {
156         return false;
157     }
158 
159     public void warn(Marker marker, String msg) {}
160 
161     public void warn(Marker marker, String format, Object arg) {}
162 
163     public void warn(Marker marker, String format, Object arg1, Object arg2) {}
164 
165     public void warn(Marker marker, String format, Object... arguments) {}
166 
167     public void warn(Marker marker, String msg, Throwable t) {}
168 
169     public boolean isErrorEnabled() {
170         return false;
171     }
172 
173     public void error(String format, Object arg) {}
174 
175     public void error(String format, Object arg1, Object arg2) {}
176 
177     public void error(String format, Object... arguments) {}
178 
179     public boolean isErrorEnabled(Marker marker) {
180         return false;
181     }
182 
183     public void error(Marker marker, String msg) {}
184 
185     public void error(Marker marker, String format, Object arg) {}
186 
187     public void error(Marker marker, String format, Object arg1, Object arg2) {}
188 
189     public void error(Marker marker, String format, Object... arguments) {}
190 
191     public void error(Marker marker, String msg, Throwable t) {}
192 }