Skip to content

Multiplatform support

Ohad Shai edited this page Sep 20, 2020 · 15 revisions

Modules

As of version 2.0 kotlin-logging composed of the following modules:

  • Common - artifact id: kotlin-logging-metadata
  • JVM - artifact id: kotlin-logging-jvm
  • JS - artifact id: kotlin-logging-js
  • Linux - artifact id: kotlin-logging-linuxx64

In order to include in gradle build file add the following dependency:

compile 'io.github.microutils:<artifact id>:<version>'
  • First supported version is 2.0.2.

Common usage

Obtaining a logger is supported only by a field (no inheritance at the moment):

private val logger = KotlinLogging.logger {}

KLogger log messages support only lazy methods messages such as:

logger.info { "Hello World!" }

JS usage

All common interfaces and methods are supported.
In addition, in order to define log level set field KotlinLoggingConfiguration.LOG_LEVEL during startup.
For example:

KotlinLoggingConfiguration.LOG_LEVEL = KotlinLoggingLevel.DEBUG
  • Default level is INFO

Linux usage

All common interfaces and methods are supported.
In addition, in order to define log level set field KotlinLoggingConfiguration.logLevel during startup.
For example:

KotlinLoggingConfiguration.logLevel = KotlinLoggingLevel.DEBUG
  • Default level is INFO