public <I> void hear(TypeLiteral<I> injectableType, TypeEncounter<I> encounter) {

    Class<? super I> type = injectableType.getRawType();
    Set<Field> loggerFields = getLoggerFieldsAnnotatedWithResource(type);
    if (loggerFields.size() == 0) return;

    Logger logger = loggerFactory.getLogger(type.getName());

    for (Field field : loggerFields) {
      if (field.isAnnotationPresent(Named.class)) {
        Named name = field.getAnnotation(Named.class);
        encounter.register(
            new AssignLoggerToField<I>(loggerFactory.getLogger(name.value()), field));
      } else {
        encounter.register(new AssignLoggerToField<I>(logger, field));
      }
    }
  }
Exemple #2
0
 protected LoggingConfig() {
   logger = FACTORY.getLogger(this.getClass().getName());
 }