Skip to content

synapticloop/simplelogger

Repository files navigation

Build Status Download GitHub Release

simplelogger

a simple, light-weight logging framework

A small (~4.9k) Simple Logger - one class, no dependencies

For when you really only need the simplest of loggers.

Usage

Include the dependency (see below), instantiate the logger, and start logging...

import synapticloop.util.simplelogger.Logger;

...

private static final Logger LOGGER = Logger.getLogger(LoggerTest.class);

// then you can log information
LOGGER.debug("message");
LOGGER.info("message");
LOGGER.warn("message");
LOGGER.error("message");
LOGGER.fatal("message");

// or throwable exceptions as well
LOGGER.debug("message", exception);
LOGGER.warn("message", exception);
LOGGER.info("message", exception);
LOGGER.error("message", exception);
LOGGER.fatal("message", exception);

Configuration

You may set logging levels globally, either through the static methods, or by including a simplelogger.properties file at the root of the classpath

Static methods

LOGGER.setShouldLogDebug(true);
LOGGER.setShouldLogInfo(true);
LOGGER.setShouldLogWarn(true);
LOGGER.setShouldLogError(true);
LOGGER.setShouldLogFatal(true);

simplelogger.properties

init=true
info=true
debug=true
warn=true
fatal=false
error=false

Code size


Line number report (NumberTextReporter)
=======================================
  File type    #    Code(      %)    Comment(      %)    Blank(      %)    Total(      %)  
-----------  ---  ---------------  ------------------  ----------------  ----------------  
      .java    1     276( 70.41%)         64( 16.33%)       52( 13.27%)      392(100.00%)  
-----------  ---  ---------------  ------------------  ----------------  ----------------  
    1 types    1     276( 70.41%)         64( 16.33%)       52( 13.27%)      392(100.00%)  
===========  ===  ===============  ==================  ================  ================  

Line number report (CumulativeBarTextReporter)
==============================================
  File type  
-----------  0                   25                  50                   75                  100
             +--------------------------------------------------------+-------------+-----------+
      .java  |########################################################|:::::::::::::|           |
             +--------------------------------------------------------+-------------+-----------+

Key:
----
  '#' code
  ':' comment
  ' ' blank

Building the Package

*NIX/Mac OS X

From the root of the project, simply run

./gradlew build

Windows

./gradlew.bat build

This will compile and assemble the artefacts into the build/libs/ directory.

Note that this may also run tests (if applicable see the Testing notes)

Running the Tests

*NIX/Mac OS X

From the root of the project, simply run

gradle --info test

if you do not have gradle installed, try:

gradlew --info test

Windows

From the root of the project, simply run

gradle --info test

if you do not have gradle installed, try:

./gradlew.bat --info test

The --info switch will also output logging for the tests

Artefact Publishing - Github

This project publishes artefacts to GitHub

Note that the latest version can be found https://github.com/synapticloop/simplelogger/releases

As such, this is not a repository, but a location to download files from.

Dependency Management Maven

This project publishes artefacts to Maven Central

Note that the latest version can be found mvn central

maven setup

No setup is required

gradle setup

Repository

repositories {
	mavenCentral()
}

Dependencies - Gradle

dependencies {
	runtime(group: 'synapticloop', name: 'simplelogger', version: '2.0.0', ext: 'jar')

	compile(group: 'synapticloop', name: 'simplelogger', version: '2.0.0', ext: 'jar')
}

or, more simply for versions of gradle greater than 2.1

dependencies {
	runtime 'synapticloop:simplelogger:2.0.0'

	compile 'synapticloop:simplelogger:2.0.0'
}

Dependencies - Maven

<dependency>
	<groupId>synapticloop</groupId>
	<artifactId>simplelogger</artifactId>
	<version>2.0.0</version>
	<type>jar</type>
</dependency>

Dependencies - Downloads

You will also need to download the following dependencies:

cobertura dependencies

  • net.sourceforge.cobertura:cobertura:2.1.1: (It may be available on one of: bintray mvn central)

testCompile dependencies

testRuntime dependencies

NOTE: You may need to download any dependencies of the above dependencies in turn (i.e. the transitive dependencies)

License

The MIT License (MIT)

Copyright (c) 2018 synapticloop

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

--

This README.md file was hand-crafted with care utilising synapticlooptemplar->documentr

--

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages