Git Product home page Git Product logo

slf4j-toys's Introduction

What is SLF4J-TOYS?

SLF4J-TOYS is collection of useful practices that complement SLF4J.

What is the purpose of SLF4J-TOYS?

SLF4J-TOYS promotes clean and organized log files, like:

[main] 25/11/2015 14:35:14 INFO dao - OK [Insert]: dao/saveUser; 0,1s; 1,5MB; login=alice; 
[main] 25/11/2015 14:36:35 INFO dao - OK [Update]: dao/saveUser; 0,1s; 1,5MB; login=bob; 
[main] 25/11/2015 14:37:27 INFO dao - REJECT [Concurrent]: dao/saveUser; 0,1s; 1,5MB; login=bob; 
[main] 25/11/2015 14:38:52 INFO dao - FAIL [OutOfQuota]: dao/saveUser; 0,1s; 1,5MB

Such messages are not only easily readable, but also easily parsable for later automatic investigation, like statistics and data mining.

Most of SLF4J-TOYS is a kind of log message builder, that suggests a coding convention for consistent logging, like:

final Meter m = MeterFactory.getMeter(LOGGER, "saveUser").start();
try {
    // Check if record exists in database   
    boolean exist = ...;
    if (exist) {
        // Insert record into database
        m2.ok("Insert");
    } else {
        // Update record in database
        m2.ok("Update");
    }
} catch (OutOfQuotaException e) {
    m2.reject(e);
} catch (SQLException e) {
    m2.fail(e);
    throw new IllegalStateException(e);
}

And produces reports about your host environment, like:

INFO report - Memory:
 - maximum allowed: 1,9GB
 - currently allocated: 129,0MB (1,8GB more available)
 - currently used: 4,1MB (124,9MB free)

It further encourages simple logger names as:

persistence.user
persistence.product

Installing and using

SLF4J-TOYS is avaiable at Maven Central repository:

<dependency>
    <groupId>org.usefultoys</groupId>
    <artifactId>slf4j-toys</artifactId>
    <version>1.5.0</version>
</dependency>

SLF4J-TOYS is also avaiable as single JAR.

Further information

Take a look at our WIKI or the API Javadoc.

Similar projects

  • Perf4J Appearantly discotinued project.
  • Spped4J A continuation and enhancement of Perf4J.

slf4j-toys's People

Contributors

danielferber avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.