001 /*
002 * HapiLogFactory.java
003 *
004 * Created on May 7, 2003 at 2:19:17 PM
005 */
006 package ca.uhn.log;
007
008 import org.slf4j.Logger;
009 import org.slf4j.LoggerFactory;
010
011
012 /**
013 * <p>Factory for creating {@link HapiLog} instances. It is factory
014 * that delegates the discovery process to the <code> LogFactory </code>
015 * class and wraps the discovered <code> Log </code> with a new instance of
016 * the <code>HapiLog</code> class.
017 *
018 * @author <a href="mailto:alexei.guevara@uhn.on.ca">Alexei Guevara</a>
019 * @deprecated use slf4j LoggerFactory
020 */
021 public final class HapiLogFactory {
022
023 /**
024 * Do not allow instantiation.
025 */
026 private HapiLogFactory() {
027 }
028
029 /**
030 * Convenience method to return a named HAPI logger, without the application
031 * having to care about factories.
032 *
033 * @param clazz Class for which a log name will be derived
034 *
035 * @exception LogConfigurationException if a suitable <code>Log</code>
036 * instance cannot be returned
037 */
038 public static HapiLog getHapiLog( Class<?> clazz ) {
039 Logger log = LoggerFactory.getLogger( clazz );
040 return new HapiLogImpl( log );
041 }
042
043 /**
044 * Convenience method to return a named HAPI logger, without the application
045 * having to care about factories.
046 *
047 * @param name Logical name of the <code>Log</code> instance to be
048 * returned (the meaning of this name is only known to the underlying
049 * logging implementation that is being wrapped)
050 *
051 * @exception LogConfigurationException if a suitable <code>Log</code>
052 * instance cannot be returned
053 */
054 public static HapiLog getHapiLog( String name ) {
055 Logger log = LoggerFactory.getLogger( name );
056 return new HapiLogImpl( log );
057 }
058
059 }
060
061