Skip to content

Commit

Permalink
update readme for version 4 beta.
Browse files Browse the repository at this point in the history
  • Loading branch information
oshai committed Feb 10, 2023
1 parent 23e2365 commit fd7744c
Showing 1 changed file with 35 additions and 9 deletions.
44 changes: 35 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# <img height="30" width="30" alt="kotlin-logging" src="https://raw.githubusercontent.com/oshai/kotlin-logging/master/misc/images/kotlin-logging.png"> [kotlin-logging](https://github.com/oshai/kotlin-logging) [![CI](https://github.com/oshai/kotlin-logging/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/oshai/kotlin-logging/actions/workflows/ci.yml) [![Slack channel](https://img.shields.io/badge/Chat-Slack-blue.svg)](https://kotlinlang.slack.com/messages/kotlin-logging/) [![Maven Central](https://img.shields.io/maven-central/v/io.github.microutils/kotlin-logging.svg)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22io.github.microutils%22) [![Apache License V.2](https://img.shields.io/badge/license-Apache%20V.2-blue.svg)](https://github.com/oshai/kotlin-logging/blob/master/LICENSE)
# <img height="30" width="30" alt="kotlin-logging" src="https://raw.githubusercontent.com/oshai/kotlin-logging/master/misc/images/kotlin-logging.png"> [kotlin-logging](https://github.com/oshai/kotlin-logging) [![CI](https://github.com/oshai/kotlin-logging/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/oshai/kotlin-logging/actions/workflows/ci.yml) [![Slack channel](https://img.shields.io/badge/Chat-Slack-blue.svg)](https://kotlinlang.slack.com/messages/kotlin-logging/) [![Maven Central](https://img.shields.io/maven-central/v/io.github.oshai/kotlin-logging.svg)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22io.github.oshai%22) [![Apache License V.2](https://img.shields.io/badge/license-Apache%20V.2-blue.svg)](https://github.com/oshai/kotlin-logging/blob/master/LICENSE)

Curious to try version 4? See https://github.com/oshai/kotlin-logging/issues/264 for details.

##

Lightweight logging framework for Kotlin, written in [![Pure Kotlin](https://img.shields.io/badge/100%25-kotlin-blue.svg)](https://kotlinlang.org/).
Lightweight Multiplatform logging framework for Kotlin, written in
[![Pure Kotlin](https://img.shields.io/badge/100%25-kotlin-blue.svg)](https://kotlinlang.org/).
A convenient and performant logging facade.
For jvm `kotlin-logging` is wrapping [slf4j](http://www.slf4j.org/) with Kotlin extensions.
For other platforms `kotlin-logging` has various implementations. More details in the [wiki](https://github.com/oshai/kotlin-logging/wiki/Multiplatform-support)
Expand Down Expand Up @@ -41,7 +38,7 @@ logger.error(exception) { "a $fancy message about the $exception" }
## Getting started

```Kotlin
import mu.KotlinLogging
import io.github.oshai.KotlinLogging
private val logger = KotlinLogging.logger {}
class FooWithLogging {
val message = "world"
Expand All @@ -53,25 +50,54 @@ class FooWithLogging {

An `Android` example project with kotlin-logging can be found in [kotlin-logging-example-android](https://github.com/oshai/kotlin-logging-example-android).

## Version 4.x vs. previous versions

Version 4 is still in beta but you're encourage to try it!
Version 4 is not backward compatible with previous versions.Group id (in maven) and packages names changed.
It is possible to use both version 4 and previous versions side-by-side so some of the code from the old version
and some new. It is also possible to have libs using old version and use the new version. In that sense it's
a completely new dependency.

Main changes are:
- Maven group id changed from `io.github.microutils` -> `io.github.oshai`.
- Root package change from `mu` -> `io.github.oshai`.
- Slf4j dependency is not provided anymore (users have to provide it). It means that 4.x can work with both slf4j 1 or 2.
- There are changes to multiplatform class hierarchy that might break compatibility.

More details in issue [#264](https://github.com/oshai/kotlin-logging/issues/264).

## Download

**Important note:** kotlin-logging depends on slf4j-api (in the JVM artifact). In runtime, it is also required to depend on a logging implementation. More details in [how-to-configure-slf4j](http://saltnlight5.blogspot.co.il/2013/08/how-to-configure-slf4j-with-different.html). And an excellent detailed explanation in [a-guide-to-logging-in-java](https://www.marcobehler.com/guides/a-guide-to-logging-in-java).
In version 4 users should also provide slf4j-api dependency.

In short, if you just want to log statements to stdout, it's possible to add the following dependency: `org.slf4j:slf4j-simple:2.0.3`.

### Maven
```xml
<dependency>
<groupId>io.github.oshai</groupId>
<artifactId>kotlin-logging-jvm</artifactId>
<version>4.0.0-beta-11</version>
</dependency>
```
Or
```xml
<dependency>
<groupId>io.github.microutils</groupId>
<artifactId>kotlin-logging-jvm</artifactId>
<version>3.0.4</version>
<version>3.0.5</version>
</dependency>
```
See the full example in [kotlin-logging-example-maven](https://github.com/oshai/kotlin-logging-example-maven).

### Gradle
```Groovy
implementation 'io.github.microutils:kotlin-logging-jvm:3.0.4'
implementation 'io.github.oshai:kotlin-logging-jvm:4.0.0-beta-11'
```
Or
```Groovy
implementation 'io.github.microutils:kotlin-logging-jvm:3.0.5'
```

Alternatively, download the JAR from [github](https://github.com/oshai/kotlin-logging/releases/latest) or [maven-central](https://repo1.maven.org/maven2/io/github/microutils/kotlin-logging/).
Expand Down

0 comments on commit fd7744c

Please sign in to comment.