log

Additional

Language
Kotlin
Version
N/A
Created
Sep 6, 2020
Updated
Sep 29, 2020
Owner
mallumo (mallumoSK)
Contributor
mallumo (mallumoSK)
1
Activity
Badge
Generate
Download
Source code

Promotion

log

Simple kotlin library for logging android and desktop projects

repositories {
    maven {
        url = uri("https://mallumo.jfrog.io/artifactory/gradle-dev-local")
    }
}

dependencies {
    implementation "tk.mallumo:log:$version"
}

library dependency

    implementation "org.jetbrains.kotlin:kotlin-stdlib:1.4.10"
    implementation 'com.google.code.gson:gson:2.8.6'

GLOBAL Enable / Disable by static variable:

tk.mallumo.log.LOGGER_IS_ENABLED

Enable / Disable by static variable:

if is library used in android project BUT in junit test, this prevent writing output to android logger output

tk.mallumo.log.LOGGER_CONSOLE_FORCE

Usage 1

tk.mallumo.log.log("123") // in console will be output ([Name-Of-Class].kt:[Souce-Code-Line-Nuber]) [name-of-method]--> [input]
//in console: 
// (LoggerTest.kt:20) testFun--> 123

Usage 2

data class Input(var itemx: String = "x")
tk.mallumo.log.log(input = Input(), prettyPrin = false)
//in console: 
// (LoggerTest.kt:20) testFun--> {"itemx":"x"}

Usage 3

logTimeSpendStampStart()
Thread.sleep(200)
logTimeSpendStamp()
Thread.sleep(1)
logTimeSpendStamp()
//in console: 
// (LoggerTest.kt:20) timeStamp--> lastStamp logging start
// (LoggerTest.kt:22) timeStamp--> lastStamp: 200ms
// (LoggerTest.kt:24) timeStamp--> lastStamp: 1ms