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