Using Clog with SLF4j

Clog4j is a fully-compatible SLF4j implementation, backed by Clog. It completely replaces Logback or Log4j, which are both unecessarily complex to set up for most projects just looking for debugging or user feedback. Clog4j lets your libraries log to Clog using the SLF4j interface, but still gives you the freedom to use the full Clog library for yourself, making it a once-size-fits-all Logger.

Features

  • All features of the base Clog library
  • Libraries that use SLF4j will be captured by Clog as well. No need to implement another logging system besides Clog, Clog4j does it all
  • Use the same {}-placeholders as expected from SLF4j, or use the more advanced parameterization from Parseltongue. Both can be use simultaneously in the same logging statement.

Get It

Include In Your Project

Clog4j can be added to your project from Jitpack through Gradle.

Add this to your project-level build.gradle:

allprojects {
  repositories {
    ...
    maven { url "https://jitpack.io" }
  }
}

Add this to your module's dependencies:

dependencies {
  ...
  api 'com.github.cjbrooks12:Clog4j:v2.0.7'
}

Github

Full source can be viewed on Github. Feel free to send me a PR.

Jitpack

Download the most recent commits, or see instructions for installing with Maven, at Jitpack.

Javadoc

View javadoc, hosted by Jitpack.

Use In Your Apps

Clog implementation

See https://javaeden.github.io/Clog for information on Clog.

Clog4j provides simple Log4j implementations for Clog. The mapping between Clog levels and Log4j levels is as follows:

Clog.v(...) ->> logger.trace(...)

Clog.d(...) ->> logger.debug(...)

Clog.i(...) ->> logger.info(...)

Clog.w(...) ->> logger.warn(...)

Clog.e(...) ->> logger.error(...)

Clog.wtf(...) ->> logger.fatal(...)

Clog tags are mapped to SLF4j markers like so:

logger.debug(MarkerManager.getMarker(tag), message);