"My log has something to tell you. Can you hear it?"
loglady is a thin wrapper around slf4j, providing a simple API similar to Python's logging module.
Using slf4j, you're free to choose whatever logging implementation suits your application or taste, but Logback seems like a good default.
The goal of the project is to be very simple, while adding as little overhead as possible.
Influences include logula and slf4s.
- Thin slf4j wrapper
- Simple API
- No configuration
- Supports Scala 2.9.1, 2.9.2 and 2.10.0
import org.eintr.loglady.Logging
class MyClass extends Logging {
log.info("Hello, Log Lady")
log.warn("We all float (%.4f) down here", 3.141592)
log.debug("Some random stuff: %d %s %x", 42, List(0, 1, 1, 2, 3, 5), -559038737)
log.error("Formatted date: %1$tm %1$te,%1$tY", new java.util.Date)
try {
throw new Exception("Oops!")
} catch {
case exc: Exception => {
log.error(exc, "Something bad happened")
}
}
}
To get logging output, you also need a concrete logging library with slf4j.
Simply adding logback-classic
as a dependency to your project is a simple
way. See the logback website for more information.
loglady is published to the Maven Central repository, requiring minimal configuration using either sbt or maven:
libraryDependencies += "org.eintr.loglady" %% "loglady" % "1.1.0"
<dependency>
<groupId>org.eintr.loglady</groupId>
<artifactId>loglady_2.10.0</artifactId>
<version>1.1.0</version>
</dependency>
Note: Replace the scala version to match that of your project.
Generated API docs (scaladoc) can be found at:
http://dln.github.com/loglady/api/
Please submit bug reports and feature requests using the Github issue tracker:
http://github.com/dln/loglady/issues
Patches and suggestions for improvements are very welcome.
Copyright (c) 2013 Daniel Lundin
This software is licensed under the Apache License, Version 2.0. Please see LICENSE for details.