@Documented @Retention(value=RUNTIME) @Target(value={METHOD,TYPE}) public @interface Loggable
Logger.
 For example, this load() method produces a log line
 on every call:
 
 @Loggable
 String load(String resource) throws IOException {
   return "something";
 }
 You can configure the level of logging:
 @Loggable(Loggable.DEBUG)
 void save(String resource) throws IOException {
   // do something
 }
 Since version 0.7.6, you can specify a maximum execution time limit for
 a method. If such a limit is reached a logging message will be issued with
 a WARN priority. It is a very convenient mechanism for profiling
 applications in production. Default value of a limit is 1 second.
 
 @Loggable(limit = 2)
 void save(String resource) throws IOException {
   // do something, potentially slow
 }
 Since version 0.7.14 you can change the time unit for the "limit" parameter. Default unit of measurement is a second:
 @Loggable(limit = 200, unit = TimeUnit.MILLISECONDS)
 void save(String resource) throws IOException {
   // do something, potentially slow
 }
 Since version 0.7.17 you can ignore certain exception types, and they won't be logged when thrown. It is very useful when exceptions are used to control flow (which is not a good practice, but is still used in some frameworks, for example in JAX-RS):
 @Loggable(ignore = WebApplicationException.class)
 String get() {
   if (not_logged_in()) {
     throw new WebApplicationException(forward_to_login_page());
   }
 }
 Since version 0.8 you can mark some exceptions as "always to be ignored",
 using Loggable.Quiet annotation.
Logger, 
http://aspects.jcabi.com/, 
Java Method Logging with AOP and Annotations, by Yegor Bugayenko| Modifier and Type | Optional Element and Description | 
|---|---|
| Class<? extends Throwable>[] | ignoreList of exception types, which should not be logged if thrown. | 
| int | limitMaximum amount allowed for this method (a warning will be
 issued if it takes longer). | 
| boolean | prependMethod entry moment should be reported as well (by default only
 an exit moment is reported). | 
| boolean | skipArgsSkip logging of arguments, replacing them all with dots? | 
| boolean | skipResultSkip logging of result, replacing it with dots? | 
| boolean | trimShall we trim long texts in order to make log lines more readable? | 
| TimeUnit | unitTime unit for the limit. | 
| int | valueLevel of logging. | 
public abstract int value
public abstract int limit
public abstract TimeUnit unit
public abstract boolean trim
public abstract boolean prepend
public abstract Class<? extends Throwable>[] ignore
You can also mark some exception types as "always to be ignored",
 using Loggable.Quiet annotation.
public abstract boolean skipResult
public abstract boolean skipArgs
Copyright © 2012–2014 jcabi.com. All rights reserved.