Git Product home page Git Product logo

async-log's Introduction

PROJECT MOVED

This project has moved to javadelight/delight-log.

Async Log

Async Log is a minimal implementation for asynchronous logging in Java.

Why: To provide a logging implementation works well in multi-threaded environments with minimal performance impact.

What Not: This library is very feature-poor by design to keep it maintainable and portable.

Usage

Creating a Log Repository

All logs are held in a log repository which can be created as follows.

PropertyNode logs = Logs.create();

Note: Before the application terminates the log repository should always be finalized as follows to ascertain that the thread used by the logging node is released.

logs.stop().get();

Log a Text Entry

The following will log a number of simple Strings.

logs.record(Logs.string("log1", "entry 1"));
logs.record(Logs.string("log1", "entry 2"));

Retrieving Logged Entries

The entries written in the previous example can be retrieved as follows:

String log1 = logs.retrieve("log1", StringLog.class).get().toString();

System.out.println(log1);

This results in an output as follows:

[
    'entry1',
    'entry1'
]

Preventing Log from Overflowing

By default individual logs are limited to 40 items. If this limit is reached, the oldest values will be purged.

A custom limit can be set by passing an integer to the logs constructor method:

PropertyNode limitedLog = Logs.create(20);

Maven Dependency

<dependency>
    <groupId>de.mxro.async.log</groupId>
	<artifactId>async-log</artifactId>
	<version>[latest version]</version>
</dependency>

Find latest version here.

Add repository if required:

<repositories>
	<repository>
		<id>Appjangle Releases</id>
		<url>http://maven.appjangle.com/appjangle/releases</url>
	</repository>
</repositories>

Compatibility

This project is compatible with the following environments:

  • Java 1.6+
  • GWT 2.5.0+
  • Android (any)
  • OSGi (any)

Further Resources

Documentation Status

async-log's People

Contributors

mxro avatar

Watchers

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