Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: cd607af3d4
Fetching contributors…

Cannot retrieve contributors at this time

103 lines (71 sloc) 2.605 kb

loglady - Crazy Simple Logging in Scala

"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.

Main Features

  • Thin slf4j wrapper
  • Simple API
  • No configuration
  • Supports Scala 2.8.1, 2.8.2, 2.9.0-1 and 2.9.1

Usage Example

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.

Getting loglady

loglady is published to the Maven Central repository, requiring minimal configuration using either sbt or maven:

sbt

libraryDependencies += "org.eintr.loglady" %% "loglady" % "1.0.0"

Maven

<dependency>
  <groupId>org.eintr.loglady</groupId>
  <artifactId>loglady_2.9.1</artifactId>
  <version>1.0.0</version>
</dependency>

Note: Replace the scala version to match that of your project.

API Documentation

Generated API docs (scaladoc) can be found at:

http://dln.github.com/loglady/api/

Bug Reports and Contributions

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

Copyright (c) 2012 Daniel Lundin

This software is licensed under the Apache License, Version 2.0. Please see LICENSE for details.

Jump to Line
Something went wrong with that request. Please try again.