| Repository | Version |
|---|---|
| Package Registry | |
| Maven Central |
A lightweight logging facade and implementation for Kotlin Multiplatform.
It integrates with existing libraries and APIs like java.logging, slf4j and Ktor.
First, add the official Maven Central repository to your settings.gradle.kts:
dependencyResolutionManagement {
repositories {
maven("https://central.sonatype.com/repository/maven-snapshots")
mavenCentral()
}
}Then add a dependency on the library in your root buildscript:
kotlin {
sourceSets {
commonMain {
dependencies {
implementation("de.connect2x.lognity:lognity-api:<version>")
implementation("de.connect2x.lognity:lognity-core:<version>")
}
}
}
}Note: for more detailed information about the features of this library,
please check out the single-file wiki!
In order to get started with Lognity, you need to pick a backend implementation.
// Use the default backend provided by the lognity-core module
Backend.set(DefaultBackend)Note: if no backend is selected explicitly, a
NoopBackendwill be provided.
Optionally, you may also pick a default configuration for all newly created Loggers.
You should always define your loggers as the interface type Logger from the lognity-api module.
New instances of this type may be obtained using the Logger pseudo-constructor.
// Creates a new logger with the default name
val myLogger: Logger = Logger()
// Creates a new logger with the specified name
val myOtherLogger: Logger = Logger("Other")Examples on how to use the Lognity API can be found in the lognity-example module.