View Javadoc
1   /*
2    * Copyright (C) 2010-2017 The Project Lombok Authors.
3    * 
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   * 
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   * 
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20   * THE SOFTWARE.
21   */
22  package lombok.extern.java;
23  
24  import java.lang.annotation.ElementType;
25  import java.lang.annotation.Retention;
26  import java.lang.annotation.RetentionPolicy;
27  import java.lang.annotation.Target;
28  
29  /**
30   * Causes lombok to generate a logger field.
31   * <p>
32   * Complete documentation is found at <a href="https://projectlombok.org/features/log">the project lombok features page for lombok log annotations</a>.
33   * <p>
34   * Example:
35   * <pre>
36   * &#64;Log
37   * public class LogExample {
38   * }
39   * </pre>
40   * 
41   * will generate:
42   * 
43   * <pre>
44   * public class LogExample {
45   *     private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(LogExample.class.getName());
46   * }
47   * </pre>
48   * 
49   * This annotation is valid for classes and enumerations.<br>
50   * @see <a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Logger.html">java.util.logging.Logger</a>
51   * @see <a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Logger.html#getLogger-java.lang.String-">java.util.logging.Logger#getLogger(java.lang.String)</a>
52   * @see lombok.extern.apachecommons.CommonsLog &#64;CommonsLog
53   * @see lombok.extern.log4j.Log4j &#64;Log4j
54   * @see lombok.extern.log4j.Log4j2 &#64;Log4j2
55   * @see lombok.extern.slf4j.Slf4j &#64;Slf4j
56   * @see lombok.extern.slf4j.XSlf4j &#64;XSlf4j
57   * @see lombok.extern.jbosslog.JBossLog &#64;JBossLog
58   * @see lombok.extern.flogger.Flogger &#64;Flogger
59   * @see lombok.CustomLog &#64;CustomLog
60   */
61  @Retention(RetentionPolicy.SOURCE)
62  @Target(ElementType.TYPE)
63  public @interface Log {
64  	/** @return The category of the constructed Logger. By default, it will use the type where the annotation is placed. */
65  	String topic() default "";
66  }