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  
20  package org.apache.fulcrum.yaafi.framework.locking;
21  
22  import org.apache.avalon.framework.logger.Logger;
23  
24  
25  /**
26   * Facade for all kinds of logging engines.
27   *
28   * @version $Revision: 1.2 $
29   */
30  public class AvalonLoggerFacade implements LoggerFacade
31  {
32      /** the logger to be used */
33      private Logger logger;
34  
35      /**
36       * Constructor
37       *
38       * @param logger the logger to use
39       */
40      public AvalonLoggerFacade(Logger logger)
41      {
42          this.logger = logger;
43      }
44  
45      /**
46       * Create a logger for the given name
47       * @param name the name
48       */
49      public LoggerFacade createLogger(String name)
50      {
51          return this;
52      }
53  
54      /**
55       * @see org.apache.fulcrum.yaafi.framework.locking.LoggerFacade#isFineEnabled()
56       */
57      public boolean isFineEnabled()
58      {
59          return this.logger.isDebugEnabled();
60      }
61  
62      /**
63       * @see org.apache.fulcrum.yaafi.framework.locking.LoggerFacade#isFinerEnabled()
64       */
65      public boolean isFinerEnabled()
66      {
67          return false;
68      }
69  
70      /**
71       * @see org.apache.fulcrum.yaafi.framework.locking.LoggerFacade#isFinestEnabled()
72       */
73      public boolean isFinestEnabled()
74      {
75          return false;
76      }
77  
78      /**
79       * @see org.apache.fulcrum.yaafi.framework.locking.LoggerFacade#logFine(java.lang.String)
80       */
81      public void logFine(String message)
82      {
83          this.logger.debug(message);
84      }
85  
86      /**
87       * @see org.apache.fulcrum.yaafi.framework.locking.LoggerFacade#logFiner(java.lang.String)
88       */
89      public void logFiner(String message)
90      {
91          this.logger.debug(message);
92      }
93  
94      /**
95       * @see org.apache.fulcrum.yaafi.framework.locking.LoggerFacade#logFinest(java.lang.String)
96       */
97      public void logFinest(String message)
98      {
99          this.logger.debug(message);
100     }
101 
102     /**
103      * @see org.apache.fulcrum.yaafi.framework.locking.LoggerFacade#logInfo(java.lang.String)
104      */
105     public void logInfo(String message)
106     {
107         this.logger.info(message);
108     }
109 
110     /**
111      * @see org.apache.fulcrum.yaafi.framework.locking.LoggerFacade#logSevere(java.lang.String, java.lang.Throwable)
112      */
113     public void logSevere(String message, Throwable t)
114     {
115         this.logger.error(message,t);
116     }
117 
118     /**
119      * @see org.apache.fulcrum.yaafi.framework.locking.LoggerFacade#logSevere(java.lang.String)
120      */
121     public void logSevere(String message)
122     {
123         this.logger.error(message);
124     }
125 
126     /**
127      * @see org.apache.fulcrum.yaafi.framework.locking.LoggerFacade#logWarning(java.lang.String, java.lang.Throwable)
128      */
129     public void logWarning(String message, Throwable t)
130     {
131         this.logger.warn(message,t);
132     }
133 
134     /**
135      * @see org.apache.fulcrum.yaafi.framework.locking.LoggerFacade#logWarning(java.lang.String)
136      */
137     public void logWarning(String message)
138     {
139         this.logger.warn(message);
140     }
141 }