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.monitor.logging;
20  
21  import org.apache.maven.plugin.logging.Log;
22  import org.codehaus.plexus.logging.Logger;
23  
24  /**
25   * @author jdcasey
26   */
27  public class DefaultLog implements Log {
28  
29      private final Logger logger;
30  
31      public DefaultLog(Logger logger) {
32          this.logger = logger;
33      }
34  
35      public void debug(CharSequence content) {
36          logger.debug(toString(content));
37      }
38  
39      private String toString(CharSequence content) {
40          if (content == null) {
41              return "";
42          } else {
43              return content.toString();
44          }
45      }
46  
47      public void debug(CharSequence content, Throwable error) {
48          logger.debug(toString(content), error);
49      }
50  
51      public void debug(Throwable error) {
52          logger.debug("", error);
53      }
54  
55      public void info(CharSequence content) {
56          logger.info(toString(content));
57      }
58  
59      public void info(CharSequence content, Throwable error) {
60          logger.info(toString(content), error);
61      }
62  
63      public void info(Throwable error) {
64          logger.info("", error);
65      }
66  
67      public void warn(CharSequence content) {
68          logger.warn(toString(content));
69      }
70  
71      public void warn(CharSequence content, Throwable error) {
72          logger.warn(toString(content), error);
73      }
74  
75      public void warn(Throwable error) {
76          logger.warn("", error);
77      }
78  
79      public void error(CharSequence content) {
80          logger.error(toString(content));
81      }
82  
83      public void error(CharSequence content, Throwable error) {
84          logger.error(toString(content), error);
85      }
86  
87      public void error(Throwable error) {
88          logger.error("", error);
89      }
90  
91      public boolean isDebugEnabled() {
92          return logger.isDebugEnabled();
93      }
94  
95      public boolean isInfoEnabled() {
96          return logger.isInfoEnabled();
97      }
98  
99      public boolean isWarnEnabled() {
100         return logger.isWarnEnabled();
101     }
102 
103     public boolean isErrorEnabled() {
104         return logger.isErrorEnabled();
105     }
106 }