You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For jvm `kotlin-logging` is wrapping [slf4j](http://www.slf4j.org/) with Kotlin extensions.
10
7
For other platforms `kotlin-logging` has various implementations. More details in the [wiki](https://github.com/oshai/kotlin-logging/wiki/Multiplatform-support)
@@ -41,7 +38,7 @@ logger.error(exception) { "a $fancy message about the $exception" }
41
38
## Getting started
42
39
43
40
```Kotlin
44
-
importmu.KotlinLogging
41
+
importio.github.oshai.KotlinLogging
45
42
privateval logger =KotlinLogging.logger {}
46
43
classFooWithLogging {
47
44
val message ="world"
@@ -53,25 +50,54 @@ class FooWithLogging {
53
50
54
51
An `Android` example project with kotlin-logging can be found in [kotlin-logging-example-android](https://github.com/oshai/kotlin-logging-example-android).
55
52
53
+
## Version 4.x vs. previous versions
54
+
55
+
Version 4 is still in beta but you're encourage to try it!
56
+
Version 4 is not backward compatible with previous versions.Group id (in maven) and packages names changed.
57
+
It is possible to use both version 4 and previous versions side-by-side so some of the code from the old version
58
+
and some new. It is also possible to have libs using old version and use the new version. In that sense it's
59
+
a completely new dependency.
60
+
61
+
Main changes are:
62
+
- Maven group id changed from `io.github.microutils` -> `io.github.oshai`.
63
+
- Root package change from `mu` -> `io.github.oshai`.
64
+
- Slf4j dependency is not provided anymore (users have to provide it). It means that 4.x can work with both slf4j 1 or 2.
65
+
- There are changes to multiplatform class hierarchy that might break compatibility.
66
+
67
+
More details in issue [#264](https://github.com/oshai/kotlin-logging/issues/264).
68
+
56
69
## Download
57
70
58
71
**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).
72
+
In version 4 users should also provide slf4j-api dependency.
59
73
60
74
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`.
61
75
62
76
### Maven
63
77
```xml
78
+
<dependency>
79
+
<groupId>io.github.oshai</groupId>
80
+
<artifactId>kotlin-logging-jvm</artifactId>
81
+
<version>4.0.0-beta-11</version>
82
+
</dependency>
83
+
```
84
+
Or
85
+
```xml
64
86
<dependency>
65
87
<groupId>io.github.microutils</groupId>
66
88
<artifactId>kotlin-logging-jvm</artifactId>
67
-
<version>3.0.4</version>
89
+
<version>3.0.5</version>
68
90
</dependency>
69
91
```
70
92
See the full example in [kotlin-logging-example-maven](https://github.com/oshai/kotlin-logging-example-maven).
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/).
0 commit comments