Extend sli4j

Exigent users that have the need to integrate not already supported logging framework, can easily do it by following the listed steps:

  1. add the core dependency in the pom.xml:
    <dependency>
        <groupId>com.google.code.sli4j</groupId>
        <artifactId>sli4j-core</artifactId>
        <version>XX.XX</version>
        <scope>compile</scope>
    </dependency>
  2. Extend the com.google.code.sli4j.core.AbstractLoggerInjector, that's the class responsibile of creating and injecting the desired Logger, specifying the Logger type:
    import java.lang.reflect.Field;
    
    import com.acme.MyLogger;
    import com.acme.MyLoggerFactory;
    
    import com.google.code.sli4j.core.AbstractLoggerInjector;
    
    public final class AcmeLoggerInjector extends AbstractLoggerInjector<MyLogger> {
    
        public AcmeLoggerInjector(Field field) {
            super(field);
        }
    
        @Override
        protected MyLogger createLogger(Class<?> klass) {
            return MyLoggerFactory.getLog(klass);
        }
    
    }
  3. Extend the com.google.code.sli4j.core.AbstractLoggingModule, specifying the Logger type and the com.google.code.sli4j.core.AbstractLoggerInjector type:
    import com.acme.MyLogger;
    
    import com.google.code.sli4j.core.AbstractLoggingModule;
    import com.google.inject.TypeLiteral;
    import com.google.inject.matcher.Matcher;
    
    public final class AcmeLoggingModule extends AbstractLoggingModule<MyLogger> {
    
        public ACLLoggingModule(Matcher<? super TypeLiteral<?>> matcher) {
            super(matcher, AcmeLoggerInjector.class);
        }
    
    }
  4. Plug your new logging module and enjoy ;)