View Javadoc

1   /*
2    * HapiLogFactory.java
3    * 
4    * Created on May 7, 2003 at 2:19:17 PM
5    */
6   package ca.uhn.log;
7   
8   import org.slf4j.Logger;
9   import org.slf4j.LoggerFactory;
10  
11  
12  /**
13   * <p>Factory for creating {@link HapiLog} instances. It is factory
14   * that delegates the discovery process to the <code> LogFactory </code>
15   * class and wraps the discovered <code> Log </code> with a new instance of
16   * the <code>HapiLog</code> class.
17   * 
18   * @author <a href="mailto:alexei.guevara@uhn.on.ca">Alexei Guevara</a>
19   * @deprecated use slf4j LoggerFactory
20   */
21  public final class HapiLogFactory {
22      
23      /**
24       * Do not allow instantiation.
25       */
26      private HapiLogFactory() {
27      }
28  
29      /**
30       * Convenience method to return a named HAPI logger, without the application
31       * having to care about factories.
32       *
33       * @param clazz Class for which a log name will be derived
34       *
35       * @exception LogConfigurationException if a suitable <code>Log</code>
36       *  instance cannot be returned
37       */
38      public static HapiLog getHapiLog( Class<?> clazz ) {
39          Logger log = LoggerFactory.getLogger( clazz );
40          return new HapiLogImpl( log );
41      }
42      
43      /**
44       * Convenience method to return a named HAPI logger, without the application
45       * having to care about factories.
46       *
47       * @param name Logical name of the <code>Log</code> instance to be
48       *  returned (the meaning of this name is only known to the underlying
49       *  logging implementation that is being wrapped)
50       *
51       * @exception LogConfigurationException if a suitable <code>Log</code>
52       *  instance cannot be returned
53       */
54      public static HapiLog getHapiLog( String name ) {
55          Logger log = LoggerFactory.getLogger( name );
56          return new HapiLogImpl( log );
57      }
58  
59  }
60  
61