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