Skip to content

asamm/logger-asamm

Repository files navigation

Logger

Logger for Asamm libraries and tools.

Quick start

Add support for JitPack to project build.gradle.kts

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

Add dependency to your build.gradle.kts module config

dependencies {
     // get Logger
     implementation("com.github.asamm:logger-asamm:[latest]")
}

Usage

  1. Initialization

As soon as possible, register your own application into logger system with own ILogger interface implementation over

Logger.registerLogger(myLoggerImpl)
  1. Usage

Use extension functions logV, logD, logI, logW and logE.

  1. Categories (optional)

Define and use own LogCategory objects. They may be supplied with the call as

logD(LogCategory.INITIALIZE) {
    "My log message with tag-prefix and visible only when certain requirements are met."
}

LogCategory, among defined tagPrefix visibel with all tags, allows to define minPriority` value that specify, since which log priority logs will be visible. Value may be modified in the runtime, so it is easy to enable/disable bunch of logs. Because category is tested before the log is created, log messages has zero impact on performance when the category is disabled!