Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix half-rdoc, half-markdwon formatting of previous commit

  • Loading branch information...
commit 30b99c2649de455432d956a8f6a74316de4cd62c 1 parent 3bb2f9b
Tim Williamson authored
Showing with 26 additions and 13 deletions.
  1. +26 −13 README.markdown
View
39 README.markdown
@@ -15,56 +15,69 @@ Mogwee Logging is just a bunch of methods to make using Log4J nicer.
## Usage
To construct a logger, add a static member variable to your class:
+
private static final Logger LOG = Logger.getLogger();
-Logger.getLogger() does some magic to determine the calling class. (Specifically, it throws and catches an exception, then walks the stack trace.) As this is not the sort of thing you want (or need) to be doing hundreds of times a second, it will log a warning if it looks like it's not being called from a static constructor.
+`Logger.getLogger()` does some magic to determine the calling class. (Specifically, it throws and catches an exception, then walks the stack trace.) As this is not the sort of thing you want (or need) to be doing hundreds of times a second, it will log a warning if it looks like it's not being called from a static constructor.
+
+Once you have a logger, there are four logging levels: `debug`, `info`, `warn`, and `error`. For each level, there are four ways to log:
+
+1. constant message
-Once you have a logger, there are four logging levels: debug, info, warn, and error. For each level, there are four ways to log:
- 1. constant message
LOG.debug("My message");
LOG.warn("My message");
LOG.info("My message");
LOG.error("My message");
- 2. constant message with cause stack trace
+
+2. constant message with cause stack trace
+
LOG.debug(e, "My message");
LOG.warn(e, "My message");
LOG.info(e, "My message");
LOG.error(e, "My message");
- 3. formatted message:
+
+3. formatted message:
+
LOG.debugf("My message: %s", message);
LOG.warnf("My message: %s", message);
LOG.infof("My message: %s", message);
LOG.errorf("My message: %s", message);
- 4. formatted message with cause stack trace
+
+4. formatted message with cause stack trace
+
LOG.debugf(e, "My message: %s", message);
LOG.warnf(e, "My message: %s", message);
LOG.infof(e, "My message: %s", message);
LOG.errorf(e, "My message: %s", message);
-For formatting, String.format() is used under the covers (but with enough smarts to not call it if the logging level isn't enabled).
+For formatting, `String.format()` is used under the covers (but with enough smarts to not call it if the logging level isn't enabled).
+
+There are also a couple more variants for the `info`, `warn`, and `error` levels:
+
+1. constant message with cause stack trace logged only if debug is enabled
-There are also a couple more variants for the info, warn, and error levels:
- 1. constant message with cause stack trace logged only if debug is enabled
LOG.warnDebug(e, "My message");
LOG.infoDebug(e, "My message");
LOG.errorDebug(e, "My message");
- 2. formatted message with cause stack trace logged only if debug is enabled
+
+2. formatted message with cause stack trace logged only if debug is enabled
+
LOG.warnDebugf(e, "My message: %s", message);
LOG.infoDebugf(e, "My message: %s", message);
LOG.errorDebugf(e, "My message: %s", message);
-== Dependencies
+## Dependencies
Mogwee Logging depends on Log4J, which is available in pretty much every Maven repository.
-== Build
+## Build
mvn install
-== License (see COPYING file for full license)
+## License (see COPYING file for full license)
Copyright 2011 Ning, Inc.
Please sign in to comment.
Something went wrong with that request. Please try again.