View Javadoc

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