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

im.aop.loggers.advice.around.LogAround 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)

There is a newer version: 1.1.3
Show newest version
package im.aop.loggers.advice.around;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.time.temporal.ChronoUnit;

import im.aop.loggers.Level;

/**
 * Log before entering and after leaving the target method, regardless of leaving normally or
 * throwing an exception.
 *
 * @author Andy Lian
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD})
@Documented
public @interface LogAround {

  /** @return Class name used as Logger's category name */
  Class declaringClass() default void.class;

  /** @return Log Level for entering, exited normally and elapsed message */
  Level level() default Level.DEFAULT;

  /** @return Entering message template */
  String enteringMessage() default "";

  /** @return Exited message template */
  String exitedMessage() default "";

  /** @return Log level for exited abnormally message */
  Level exitedAbnormallyLevel() default Level.DEFAULT;

  /** @return Exited abnormally message template */
  String exitedAbnormallyMessage() default "";

  /** @return Exceptions that will be ignored by Logger */
  Class[] ignoreExceptions() default {};

  /** @return Whether to print exception and its backtrace */
  boolean printStackTrace() default true;

  /** @return Elapsed message template */
  String elapsedMessage() default "";

  /** @return Log level for elapsed warning message */
  Level elapsedWarningLevel() default Level.DEFAULT;

  /** @return Elapsed warning message template */
  String elapsedWarningMessage() default "";

  /** @return Elapsed time limit to log elapsed warning message */
  long elapsedTimeLimit() default 0;

  /** @return Elapsed time unit */
  ChronoUnit elapsedTimeUnit() default ChronoUnit.MILLIS;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy