CHINESE | ENGLISH (Google Translate)
LOGGER4K
Is a lightweight Kotlin
logging framework.
This project used Gradle
to build coverage Junit
test.
If you find a bug or comments, you can feedback under Issues
.
Before you start, you need to introduce the module into the project. The introduction of
Apache Maven
andGradle
is introduced below.
Maven
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Gradle
allprojects {
repositories {
// ...
maven { url 'https://jitpack.io' }
}
}
Maven
<dependency>
<groupId>com.github.OpenEdgn.Logger4K</groupId>
<artifactId>${modName}</artifactId>
<version>${version}</version>
</dependency>
Gradle
dependencies {
implementation 'com.github.OpenEdgn.Logger4K:${modName}:${version}'
}
$ {modName}
represents the module name, and$ {version}
represents the referenced version number.
Basic usage of the Logger API:
val logger = getLogger () // Create a Logger object
logger.debug ( " DEBUG Message. " )
// Output DEBUG type log (note that the log will not be output if DEBUG is not enabled)
logger.info ( " INFO Message. " )
// Output INFO type log
logger.warn (" WARN Message. ")
// Output WARN type log
logger.error("ERROR Message.")
// Output log of ERROR type
logger.debugOnly {
// This code block only runs in debug mode
info("INFO")
warn("WARN")
debug("DEBUG")
error("ERROR")
}
Please see PrintLogger.kt
and LoggerMainTestAll.kt under TEST
for more usage methods.
SEE LICENSE FILE