diff options
author | Roel Spilker <r.spilker@gmail.com> | 2010-11-06 22:01:18 +0100 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2010-11-06 22:01:18 +0100 |
commit | d1addc14d5c2430c2b9fbea3081884d4f9d62a4c (patch) | |
tree | 6b0423544bdc0011546edf37816c56ff442b2002 | |
parent | 3cbd92e1b29b23ca543c6cced4f96d1cc68d7d0f (diff) | |
download | lombok-d1addc14d5c2430c2b9fbea3081884d4f9d62a4c.tar.gz lombok-d1addc14d5c2430c2b9fbea3081884d4f9d62a4c.tar.bz2 lombok-d1addc14d5c2430c2b9fbea3081884d4f9d62a4c.zip |
Updated website documentation to include @Log
-rw-r--r-- | buildScripts/website.ant.xml | 3 | ||||
-rw-r--r-- | usage_examples/LogExample_post.jpage | 15 | ||||
-rw-r--r-- | usage_examples/LogExample_pre.jpage | 17 | ||||
-rw-r--r-- | website/features/Log.html | 76 | ||||
-rw-r--r-- | website/features/SneakyThrows.html | 2 | ||||
-rw-r--r-- | website/features/features.css | 29 | ||||
-rw-r--r-- | website/features/index.html | 2 |
7 files changed, 143 insertions, 1 deletions
diff --git a/buildScripts/website.ant.xml b/buildScripts/website.ant.xml index 73700a82..6ab8d509 100644 --- a/buildScripts/website.ant.xml +++ b/buildScripts/website.ant.xml @@ -132,6 +132,9 @@ such as converting the changelog into HTML, and creating javadoc. <antcall target="-integrateSnippet"> <param name="transformationName" value="Constructor" /> </antcall> + <antcall target="-integrateSnippet"> + <param name="transformationName" value="Log" /> + </antcall> </target> <target name="-website-dist"> diff --git a/usage_examples/LogExample_post.jpage b/usage_examples/LogExample_post.jpage new file mode 100644 index 00000000..cbdc5a9e --- /dev/null +++ b/usage_examples/LogExample_post.jpage @@ -0,0 +1,15 @@ +public class LogExample { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LogExample.class); + + public static void main(String... args) { + log.error("Something's wrong here"); + } +} + +public class LogExampleOther { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(java.util.List.class); + + public static void main(String... args) { + log.warn("Something might be wrong here"); + } +} diff --git a/usage_examples/LogExample_pre.jpage b/usage_examples/LogExample_pre.jpage new file mode 100644 index 00000000..450a6a34 --- /dev/null +++ b/usage_examples/LogExample_pre.jpage @@ -0,0 +1,17 @@ +import lombok.slf4j.Log; + +@Log +public class LogExample { + + public static void main(String... args) { + log.error("Something's wrong here"); + } +} + +@Log(java.util.List.class) +public class LogExampleOther { + + public static void main(String... args) { + log.warn("Something might be wrong here"); + } +} diff --git a/website/features/Log.html b/website/features/Log.html new file mode 100644 index 00000000..45beca77 --- /dev/null +++ b/website/features/Log.html @@ -0,0 +1,76 @@ +<!DOCTYPE html> +<html><head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <link rel="stylesheet" type="text/css" href="../logi/reset.css" /> + <link rel="stylesheet" type="text/css" href="features.css" /> + <link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" /> + <meta name="description" content="Spice up your java" /> + <title>@Log</title> +</head><body><div id="pepper"> + <div class="minimumHeight"></div> + <div class="meat"> + <div class="header"><a href="../index.html">Project Lombok</a></div> + <h1>@Log</h1> + <div class="byline">Captain's Log, stardate 24435.7: "What was that line again?"</div> + <div class="overview"> + <h3>Overview</h3> + <p> + You can annotate any field with <code>@Log</code> to let lombok generate a logger field automatically.<br /> + The logger is named <code>log</code> and field's type depends on which logger you have selected. + </p><p> + There are four <code>@Log</code> choices available:<br /> + <dl> + <dt><code>@lombok.commons.Log</code></dt> + <dd>Creates <code><span class="keyword">private static final </span><a href="http://commons.apache.org/logging/apidocs/org/apache/commons/logging/Log.html">org.apache.commons.logging.Log</a> <span class="staticfield">log</span> = <a href="http://commons.apache.org/logging/apidocs/org/apache/commons/logging/LogFactory.html#getLog(java.lang.Class)">org.apache.commons.logging.LogFactory.getLog</a>(TargetType.<span class="keyword">class</span>);</code></dd> + <dt><code>@lombok.jul.Log</code></dt> + <dd>Creates <code><span class="keyword">private static final </span><a href="http://download.oracle.com/javase/6/docs/api/java/util/logging/Logger.html">java.util.logging.Logger</a> <span class="staticfield">log</span> = <a href="http://download.oracle.com/javase/6/docs/api/java/util/logging/Logger.html#getLogger(java.lang.String)">java.util.logging.Logger.getLogger</a>(TargetType.<span class="keyword">class</span>.getName());</code></dd> + <dt><code>@lombok.log4j.Log</code></dt> + <dd>Creates <code><span class="keyword">private static final </span><a href="http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Logger.html">org.apache.log4j.Logger</a> <span class="staticfield">log</span> = <a href="http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Logger.html#getLogger(java.lang.Class)">org.apache.log4j.Logger.getLogger</a>(TargetType.<span class="keyword">class</span>);</code></dd> + <dt><code>@lombok.slf4j.Log</code></dt> + <dd>Creates <code><span class="keyword">private static final </span><a href="http://www.slf4j.org/api/org/slf4j/Logger.html">org.slf4j.Logger</a> <span class="staticfield">log</span> = <a href="http://www.slf4j.org/apidocs/org/slf4j/LoggerFactory.html#getLogger(java.lang.Class)">org.slf4j.LoggerFactory.getLogger</a>(TargetType.<span class="keyword">class</span>);</code></dd> + </dl> + </p> + <p> + All <code>@Log</code> annotations can take an optional parameter of type <code>Class</code>. If such a parameter is specified, that class will be used as the parameter for the logger factory call. + </p> + </div> + <div class="snippets"> + <div class="pre"> + <h3>With Lombok</h3> + <div class="snippet">@HTML_PRE@</div> + </div> + <div class="sep"></div> + <div class="post"> + <h3>Vanilla Java</h3> + <div class="snippet">@HTML_POST@</div> + </div> + </div> + <div style="clear: left;"></div> + <div class="overview"> + <h3>Small print</h3><div class="smallprint"> + <p> + If a field called <code>log</code> already exists, a warning will be emitted and no code will be generated. + </p> + <p> + Although it is possible to specify any class literal to pass to the logger factory method, passing <code>void.class</code> will be considered to be the same as specifying no parameter. + </p> + </div> + </div> + <div class="footer"> + <a href="index.html">Back to features</a> | <a href="SneakyThrows.html">Previous feature (@SneakyThrows)</a> | <span class="disabled">Next feature</span><br /> + <a href="../credits.html" class="creditsLink">credits</a> | <span class="copyright">Copyright © 2009-2010 Reinier Zwitserloot, Roel Spilker and Robbert Jan Grootjans, licensed under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT license</a>.</span> + </div> + <div style="clear: both;"></div> + </div> +</div> +<script type="text/javascript"> + var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); + document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); +</script> +<script type="text/javascript"> + try { + var pageTracker = _gat._getTracker("UA-9884254-1"); + pageTracker._trackPageview(); + } catch(err) {} +</script> +</body></html> diff --git a/website/features/SneakyThrows.html b/website/features/SneakyThrows.html index ec7d09c5..0781f083 100644 --- a/website/features/SneakyThrows.html +++ b/website/features/SneakyThrows.html @@ -71,7 +71,7 @@ </div> </div> <div class="footer"> - <a href="index.html">Back to features</a> | <a href="Synchronized.html">Previous feature (@Synchronized)</a> | <span class="disabled">Next feature</span><br /> + <a href="index.html">Back to features</a> | <a href="Synchronized.html">Previous feature (@Synchronized)</a> | <a href="Log.html">Next feature (@Log)</a><br /> <a href="../credits.html" class="creditsLink">credits</a> | <span class="copyright">Copyright © 2009 Reinier Zwitserloot and Roel Spilker, licensed under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT license</a>.</span> </div> <div style="clear: both;"></div> diff --git a/website/features/features.css b/website/features/features.css index 5de41654..a7e8e318 100644 --- a/website/features/features.css +++ b/website/features/features.css @@ -64,6 +64,15 @@ h1 { margin-left: 32px; } +dt { + margin-top: 4px; + font-size: 1.2em; +} + +dd { + margin-left: 16px; +} + .overview code { font-size: 1.1em; } @@ -138,3 +147,23 @@ h1 { font-style: normal; font-weight: bold; } + +code a { + color: black; + text-decoration: none; +} + +code a:hover { + color: black; + text-decoration: underline; +} + +code .keyword { + color: #7f0055; + font-weight: bold; +} + +code .staticfield { + color: #2a00ff; + font-style: italic; +}
\ No newline at end of file diff --git a/website/features/index.html b/website/features/index.html index 869bbe89..d216ddb4 100644 --- a/website/features/index.html +++ b/website/features/index.html @@ -30,6 +30,8 @@ <dd><code>synchronized</code> done right: Don't expose your locks.</dd> <dt><a href="SneakyThrows.html"><code>@SneakyThrows</code></a></dt> <dd>To boldly throw checked exceptions where no one has thrown them before!</dd> + <dt><a href="Log.html"><code>@Log</code></a></dt> + <dd>Captain's Log, stardate 24435.7: "What was that line again?"</dd> </dl> </div> <div class="pointer"> |