All Downloads are FREE. Search and download functionalities are using the official Maven repository.

im.aop.loggers.messageinterpolation.ElapsedTimeLimitStringSupplierRegistrar Maven / Gradle / Ivy

Go to download

A handy and configurable sets of annotation-based loggers for Spring Boot that can log every execution of a method when entering or exiting normally or abnormally, without you writing a single line of code using aspect-oriented programming (AOP)

The newest version!
package im.aop.loggers.messageinterpolation;

import java.time.Duration;

public class ElapsedTimeLimitStringSupplierRegistrar implements StringSupplierRegistrar {

  private static final String ELAPSED_TIME_LIMIT_KEY = "elapsed-time-limit";

  @Override
  public void register(StringSupplierLookup stringSupplierLookup, Duration source) {
    stringSupplierLookup.addStringSupplier(ELAPSED_TIME_LIMIT_KEY, () -> elapsedTimeLimit(source));
  }

  private String elapsedTimeLimit(Duration elapsedTimeLimit) {
    return elapsedTimeLimit.toString();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy