From e77837fa58dc379b9db523eb757cd077cf247b28 Mon Sep 17 00:00:00 2001 From: Neeme Praks Date: Tue, 14 Jan 2025 11:05:59 +0200 Subject: [PATCH] Kotlin compiler plugin --- build.gradle.kts | 9 +- kotlin-ir-plugin-gradle/README.md | 4 + kotlin-ir-plugin-gradle/build.gradle.kts | 52 + .../irplugin/KotlinLoggingGradleExtension.kt | 31 + .../irplugin/KotlinLoggingGradlePlugin.kt | 73 + kotlin-ir-plugin/README.md | 337 + kotlin-ir-plugin/build.gradle.kts | 51 + kotlin-ir-plugin/code-samples-from-tests.md | 146488 +++++++++++++++ .../KotlinLoggingCommandLineProcessor.kt | 120 + .../KotlinLoggingCompilerRegistrar.kt | 69 + .../KotlinLoggingIrGenerationExtension.kt | 898 + .../irplugin/KotlinLoggingIrPluginConfig.kt | 10 + .../kotlinlogging/irplugin/SourceFile.kt | 78 + .../kotlinlogging/irplugin/CompiledTest.kt | 77 + .../EventCollectingLogbackAppender.kt | 24 + .../kotlinlogging/irplugin/ExecutedTest.kt | 106 + .../kotlinlogging/irplugin/FeatureFlag.kt | 62 + .../KotlinLoggingIrGenerationExtensionTest.kt | 684 + .../kotlinlogging/irplugin/LogStatement.kt | 7 + .../kotlinlogging/irplugin/PreparedTest.kt | 66 + .../kotlinlogging/irplugin/TestCollection.kt | 103 + .../kotlinlogging/irplugin/TestCompiler.kt | 67 + .../kotlinlogging/irplugin/TestDefinition.kt | 251 + .../irplugin/TestExecutionResult.kt | 64 + .../irplugin/TestLoggingLevel.kt | 11 + .../src/test/resources/logback.xml | 13 + kotlin-ir-plugin/tests.md | 146485 ++++++++++++++ settings.gradle.kts | 5 + .../internal/KLoggerInternalExtensions.kt | 53 + .../kotlinlogging/internal/MessageInvoker.kt | 10 +- .../logback/internal/LogbackLoggerFactory.kt | 5 +- 31 files changed, 296309 insertions(+), 4 deletions(-) create mode 100644 kotlin-ir-plugin-gradle/README.md create mode 100644 kotlin-ir-plugin-gradle/build.gradle.kts create mode 100644 kotlin-ir-plugin-gradle/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingGradleExtension.kt create mode 100644 kotlin-ir-plugin-gradle/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingGradlePlugin.kt create mode 100644 kotlin-ir-plugin/README.md create mode 100644 kotlin-ir-plugin/build.gradle.kts create mode 100644 kotlin-ir-plugin/code-samples-from-tests.md create mode 100644 kotlin-ir-plugin/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingCommandLineProcessor.kt create mode 100644 kotlin-ir-plugin/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingCompilerRegistrar.kt create mode 100644 kotlin-ir-plugin/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingIrGenerationExtension.kt create mode 100644 kotlin-ir-plugin/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingIrPluginConfig.kt create mode 100644 kotlin-ir-plugin/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/SourceFile.kt create mode 100644 kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/CompiledTest.kt create mode 100644 kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/EventCollectingLogbackAppender.kt create mode 100644 kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/ExecutedTest.kt create mode 100644 kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/FeatureFlag.kt create mode 100644 kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingIrGenerationExtensionTest.kt create mode 100644 kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/LogStatement.kt create mode 100644 kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/PreparedTest.kt create mode 100644 kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/TestCollection.kt create mode 100644 kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/TestCompiler.kt create mode 100644 kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/TestDefinition.kt create mode 100644 kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/TestExecutionResult.kt create mode 100644 kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/TestLoggingLevel.kt create mode 100644 kotlin-ir-plugin/src/test/resources/logback.xml create mode 100644 kotlin-ir-plugin/tests.md create mode 100644 src/commonMain/kotlin/io/github/oshai/kotlinlogging/internal/KLoggerInternalExtensions.kt diff --git a/build.gradle.kts b/build.gradle.kts index eba34f42..4ff64d24 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,6 +6,11 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +buildscript { + extra["kotlin_plugin_id"] = "io.github.oshai.kotlinlogging.kotlin-ir-plugin" + extra["kotlin_plugin_package_name"] = "io.github.oshai.kotlinlogging.irplugin" +} + plugins { kotlin("multiplatform") version "2.0.21" // This version is dependent on the maximum tested version @@ -14,9 +19,11 @@ plugins { id("org.jetbrains.dokka") version "2.0.0" - id("com.diffplug.spotless") version "7.0.1" + id("com.diffplug.spotless") id("io.github.gradle-nexus.publish-plugin") version "2.0.0" + id("com.gradle.plugin-publish") version "1.2.1" apply false + id("com.github.gmazzo.buildconfig") version "5.3.5" apply false `maven-publish` signing } diff --git a/kotlin-ir-plugin-gradle/README.md b/kotlin-ir-plugin-gradle/README.md new file mode 100644 index 00000000..19b9ab84 --- /dev/null +++ b/kotlin-ir-plugin-gradle/README.md @@ -0,0 +1,4 @@ +# Gradle wrapper plugin for Kotlin (IR) compiler plugin for kotlin-logging + +Just a Gradle wrapper for the Kotlin (IR) Compiler plugin for kotlin-logging, +see [kotlin-ir-plugin](../kotlin-ir-plugin) for the actual Kotlin (IR) compiler plugin. diff --git a/kotlin-ir-plugin-gradle/build.gradle.kts b/kotlin-ir-plugin-gradle/build.gradle.kts new file mode 100644 index 00000000..6cd050e9 --- /dev/null +++ b/kotlin-ir-plugin-gradle/build.gradle.kts @@ -0,0 +1,52 @@ +plugins { + id("java-gradle-plugin") + id("com.gradle.plugin-publish") version "1.2.1" + kotlin("jvm") + id("com.github.gmazzo.buildconfig") + id("com.diffplug.spotless") + +} +repositories { + mavenCentral() +} + +dependencies { + implementation(kotlin("gradle-plugin-api")) +} + +buildConfig { + val project = project(":kotlin-ir-plugin") + packageName("${rootProject.extra["kotlin_plugin_package_name"]}") + buildConfigField("String", "KOTLIN_PLUGIN_ID", "\"${rootProject.extra["kotlin_plugin_id"]}\"") + buildConfigField("String", "KOTLIN_PLUGIN_GROUP", "\"${project.group}\"") + buildConfigField("String", "KOTLIN_PLUGIN_NAME", "\"${project.name}\"") + buildConfigField("String", "KOTLIN_PLUGIN_VERSION", "\"${project.version}\"") +} + +gradlePlugin { + plugins { + create("kotlinLoggingIrPlugin") { + id = rootProject.extra["kotlin_plugin_id"] as String + displayName = "kotlin-logging IR plugin" + description = "Collects metadata about logging calls from the source code and adds it to the respective calls" + implementationClass = "io.github.oshai.kotlinlogging.irplugin.KotlinLoggingGradlePlugin" + } + } +} + +publishing { + repositories { + maven { + name = "localPluginRepository" + url = uri(rootProject.layout.buildDirectory.dir("local-plugin-repository")) + } + } +} + +// Static code analysis tools +spotless { + kotlin { + target("src/**/*.kt") + ktfmt("0.47").googleStyle() + } +} diff --git a/kotlin-ir-plugin-gradle/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingGradleExtension.kt b/kotlin-ir-plugin-gradle/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingGradleExtension.kt new file mode 100644 index 00000000..918787ae --- /dev/null +++ b/kotlin-ir-plugin-gradle/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingGradleExtension.kt @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2020 Brian Norman + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.github.oshai.kotlinlogging.irplugin + +import org.gradle.api.model.ObjectFactory +import org.gradle.api.provider.Property + +// Based on https://github.com/bnorm/kotlin-ir-plugin-template +open class KotlinLoggingGradleExtension(objects: ObjectFactory) { + val disableAll: Property = objects.property(String::class.java) + val disableTransformingDeprecatedApi: Property = objects.property(String::class.java) + val disableTransformingNotImplementedApi: Property = objects.property(String::class.java) + val disableTransformingEntryExitApi: Property = objects.property(String::class.java) + val disableTransformingThrowingCatchingApi: Property = + objects.property(String::class.java) + val disableCollectingCallSiteInformation: Property = objects.property(String::class.java) +} diff --git a/kotlin-ir-plugin-gradle/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingGradlePlugin.kt b/kotlin-ir-plugin-gradle/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingGradlePlugin.kt new file mode 100644 index 00000000..d2abc4aa --- /dev/null +++ b/kotlin-ir-plugin-gradle/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingGradlePlugin.kt @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2020 Brian Norman + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.github.oshai.kotlinlogging.irplugin + +import org.gradle.api.Project +import org.gradle.api.provider.Provider +import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation +import org.jetbrains.kotlin.gradle.plugin.KotlinCompilerPluginSupportPlugin +import org.jetbrains.kotlin.gradle.plugin.SubpluginArtifact +import org.jetbrains.kotlin.gradle.plugin.SubpluginOption + +// Based on https://github.com/bnorm/kotlin-ir-plugin-template +class KotlinLoggingGradlePlugin : KotlinCompilerPluginSupportPlugin { + override fun apply(target: Project): Unit = + with(target) { extensions.create("kotlinlogging", KotlinLoggingGradleExtension::class.java) } + + override fun isApplicable(kotlinCompilation: KotlinCompilation<*>): Boolean = true + + override fun getCompilerPluginId(): String = BuildConfig.KOTLIN_PLUGIN_ID + + override fun getPluginArtifact(): SubpluginArtifact = + SubpluginArtifact( + groupId = BuildConfig.KOTLIN_PLUGIN_GROUP, + artifactId = BuildConfig.KOTLIN_PLUGIN_NAME, + version = BuildConfig.KOTLIN_PLUGIN_VERSION, + ) + + override fun applyToCompilation( + kotlinCompilation: KotlinCompilation<*> + ): Provider> { + val project = kotlinCompilation.target.project + val extension = project.extensions.getByType(KotlinLoggingGradleExtension::class.java) + return project.provider { + listOf( + SubpluginOption(key = "disableAll", value = extension.disableAll.get()), + SubpluginOption( + key = "disableTransformingDeprecatedApi", + value = extension.disableTransformingDeprecatedApi.get(), + ), + SubpluginOption( + key = "disableTransformingNotImplementedApi", + value = extension.disableTransformingNotImplementedApi.get(), + ), + SubpluginOption( + key = "disableTransformingEntryExitApi", + value = extension.disableTransformingEntryExitApi.get(), + ), + SubpluginOption( + key = "disableTransformingThrowingCatchingApi", + value = extension.disableTransformingThrowingCatchingApi.get(), + ), + SubpluginOption( + key = "disableCollectingCallSiteInformation", + value = extension.disableCollectingCallSiteInformation.get(), + ), + ) + } + } +} diff --git a/kotlin-ir-plugin/README.md b/kotlin-ir-plugin/README.md new file mode 100644 index 00000000..4c581156 --- /dev/null +++ b/kotlin-ir-plugin/README.md @@ -0,0 +1,337 @@ +# Kotlin (IR) compiler plugin for kotlin-logging + +Kotlin (IR) compiler plugin for kotlin-logging that adds the following features when used with [Logback](https://logback.qos.ch) backend +(see also [ILoggingEvent](https://github.com/qos-ch/logback/blob/master/logback-classic/src/main/java/ch/qos/logback/classic/spi/ILoggingEvent.java)): + +* Collect (during compile-time) and fill in log message template returned from `ILoggingEvent.getMessage()` method. + Fully formatted message is returned from `ILoggingEvent.getFormattedMessage()` method. + As a side-effect of this feature, `ILoggingEvent.getArgumentArray()` will no longer be returning the argument values + (as the message template is merged with arguments during compile-time). +* Collect (during compile-time) and fill in caller data returned from `ILoggingEvent.getCallerData()` method. Typically, + this is implemented by throwing an exception at runtime and capturing the stack trace. This plugin will capture the call site + during compile-time and fill in the caller data (so you get it for free at runtime). + +In short, it transforms code like this: +```kotlin +package test +import io.github.oshai.kotlinlogging.* + +class MainTest { + val logger = KotlinLogging.logger {} + fun main() { + val name = "world" + logger.info { "Hello, $name" } + } +} +``` +into this: +```kotlin +package test +import io.github.oshai.kotlinlogging.* + +class MainTest { + val logger = KotlinLogging.logger {} + fun main() { + val name = "world" + logger.at(Level.INFO) { + message = "Hello, $name" + cause = throwable + internalCompilerData = KLoggingEventBuilder.InternalCompilerData( + messageTemplate = "\"Hello, \$name\"", + className = "test.MainTest", + methodName = "main", + fileName = "test.kt", + lineNumber = 8 + ) + } + } +} +``` + +For more details, see [What does it do (in detail)?](#what-does-it-do-in-detail) section. + +## Usage + +Add the following to the `build.gradle.kts` of your Kotlin project: + +```kotlin +plugins { + id("io.github.oshai.kotlinlogging.kotlin-ir-plugin") version "" +} + +dependencies { + // Add kotlin-logging dependency + // Optional: add Logback dependency +} + +// Optional: configure the plugin (by default all features are enabled) +kotlinlogging { + disableAll = false + disableTransformingDeprecatedApi = false + disableTransformingNotImplementedApi = false + disableTransformingEntryExitApi = false + disableTransformingThrowingCatchingApi = false + disableCollectingCallSiteInformation = false +} +``` + +**Note:** in order to use log message template feature you will need to use Logback as your logging backend (and +to set `kotlin-logging-to-logback` system property to `true` in your application JVM). Other logging backends do not +support passing through the message template to the log appender. + +## Feature flags + +The plugin can be configured using the following flags: + +* `disableAll` - disables all features of the plugin (default: `false`), all code is left unchanged. +* `disableTransformingDeprecatedApi` - disables transforming deprecated `KLogger` API calls (default: `false`). +* `disableTransformingNotImplementedApi` - disables transforming `KLogger` API calls that have not been implemented (default: `false`). +* `disableTransformingEntryExitApi` - disables transforming `KLogger` API calls for entry/exit logging (default: `false`). +* `disableTransformingThrowingCatchingApi` - disables transforming `KLogger` API calls for throwing/catching exceptions (default: `false`). +* `disableCollectingCallSiteInformation` - disables collecting call site information (default: `false`). + +## What does it do (in detail)? + +The plugin is implemented using Kotlin IR compiler plugin API. It hooks into the Kotlin compiler and modifies the AST +(Abstract Syntax Tree) of the project code. The plugin is applied to the whole project and it modifies all the classes that +use the [https://github.com/oshai/kotlin-logging/blob/master/src/commonMain/kotlin/io/github/oshai/kotlinlogging/KLogger.kt](KLogger) API +from `kotlin-logging` library (other classes are not touched). + +### In detail + +Part of the `kotlin-logging` `KLogger` API is the [https://github.com/oshai/kotlin-logging/blob/master/src/commonMain/kotlin/io/github/oshai/kotlinlogging/KLoggingEventBuilder.kt](KLoggingEventBuilder) +class that is used to lazily build the log event. In order to support this compiler plugin, this class has been extended +with a field of type `InternalCompilerData` - this allows the compile-time message template and caller data to be passed +from project code to the `kotlin-logging` backend. + +The main transformation performed by the plugin is to rewrite all logging calls to the `KLogger` API by redirecting them to +```kotlin +fun at(level: Level, marker: Marker? = null, block: KLoggingEventBuilder.() -> Unit) +``` +Internal compiler data in `KLoggingEventBuilder` is filled with the message template and caller data, collected from the source code. + +Depending on the original logging API call, the plugin does some additional transformations, see below. + +For even more details, you can check the [code-samples-from-tests.md](code-samples-from-tests.md) file - it is generated +by the plugin test-suite and it contains all the test cases that the plugin is tested against with before+after code +snippets and how different feature flags affect the transformation. + +#### Message-builder lambda API calls + +```kotlin +fun trace(message: () -> Any?): Unit +fun debug(message: () -> Any?): Unit +fun info(message: () -> Any?): Unit +fun warn(message: () -> Any?): Unit +fun error(message: () -> Any?): Unit + +fun trace(throwable: Throwable?, message: () -> Any?): Unit +fun debug(throwable: Throwable?, message: () -> Any?): Unit +fun info(throwable: Throwable?, message: () -> Any?): Unit +fun warn(throwable: Throwable?, message: () -> Any?): Unit +fun error(throwable: Throwable?, message: () -> Any?): Unit + +fun trace(throwable: Throwable? = null, marker: Marker?, message: () -> Any?): Unit +fun debug(throwable: Throwable? = null, marker: Marker?, message: () -> Any?): Unit +fun info(throwable: Throwable? = null, marker: Marker?, message: () -> Any?): Unit +fun warn(throwable: Throwable? = null, marker: Marker?, message: () -> Any?): Unit +fun error(throwable: Throwable? = null, marker: Marker?, message: () -> Any?): Unit + +// deprecated +fun trace(marker: Marker?, msg: () -> Any?): Unit +fun debug(marker: Marker?, msg: () -> Any?): Unit +fun info(marker: Marker?, msg: () -> Any?): Unit +fun warn(marker: Marker?, msg: () -> Any?): Unit +fun error(marker: Marker?, msg: () -> Any?): Unit + +// deprecated +fun trace(marker: Marker?, t: Throwable?, msg: () -> Any?): Unit +fun debug(marker: Marker?, t: Throwable?, msg: () -> Any?): Unit +fun info(marker: Marker?, t: Throwable?, msg: () -> Any?): Unit +fun warn(marker: Marker?, t: Throwable?, msg: () -> Any?): Unit +fun error(marker: Marker?, t: Throwable?, msg: () -> Any?): Unit +``` + +Transformed to the `at` API with the message template filled in: +```kotlin + logger.at(Level.TRACE|DEBUG|INFO|WARN|ERROR) { + message = message.toStringSafe() + cause = throwable + internalCompilerData = KLoggingEventBuilder.InternalCompilerData( + messageTemplate = "", + // other fields omitted for brevity + ) + } +``` + +#### Event-builder lambda API calls + +```kotlin +fun atTrace(marker: Marker?, block: KLoggingEventBuilder.() -> Unit): Unit +fun atDebug(marker: Marker?, block: KLoggingEventBuilder.() -> Unit): Unit +fun atInfo(marker: Marker?, block: KLoggingEventBuilder.() -> Unit): Unit +fun atWarn(marker: Marker?, block: KLoggingEventBuilder.() -> Unit): Unit +fun atError(marker: Marker?, block: KLoggingEventBuilder.() -> Unit): Unit + +fun atTrace(block: KLoggingEventBuilder.() -> Unit): Unit +fun atDebug(block: KLoggingEventBuilder.() -> Unit): Unit +fun atInfo(block: KLoggingEventBuilder.() -> Unit): Unit +fun atWarn(block: KLoggingEventBuilder.() -> Unit): Unit +fun atError(block: KLoggingEventBuilder.() -> Unit): Unit +``` + +As this API is already using the `KLoggingEventBuilder` class, the plugin only fills in the compiler data and attaches +it to the `KLoggingEventBuilder` instance. +```kotlin + // logging call remains as-is + internalCompilerData = KLoggingEventBuilder.InternalCompilerData( + messageTemplate = "", + // other fields omitted for brevity + ) +``` + +#### Log-message-as-plain-String API calls, non-parameterized + +```kotlin +fun trace(msg: String?): Unit +fun debug(msg: String?): Unit +fun info(msg: String?): Unit +fun warn(msg: String?): Unit +fun error(msg: String?): Unit + +// deprecated +fun trace(msg: String?, t: Throwable?): Unit +fun debug(msg: String?, t: Throwable?): Unit +fun info(msg: String?, t: Throwable?): Unit +fun warn(msg: String?, t: Throwable?): Unit +fun error(msg: String?, t: Throwable?): Unit + +// deprecated +fun trace(marker: Marker?, msg: String?): Unit +fun debug(marker: Marker?, msg: String?): Unit +fun info(marker: Marker?, msg: String?): Unit +fun warn(marker: Marker?, msg: String?): Unit +fun error(marker: Marker?, msg: String?): Unit + +// deprecated +fun trace(marker: Marker?, msg: String?, t: Throwable?): Unit +fun debug(marker: Marker?, msg: String?, t: Throwable?): Unit +fun info(marker: Marker?, msg: String?, t: Throwable?): Unit +fun warn(marker: Marker?, msg: String?, t: Throwable?): Unit +fun error(marker: Marker?, msg: String?, t: Throwable?): Unit +``` + +Transformed to the `at` API with the message template filled in: +```kotlin + logger.at(Level.TRACE|DEBUG|INFO|WARN|ERROR) { + message = message + cause = throwable + internalCompilerData = KLoggingEventBuilder.InternalCompilerData( + messageTemplate = "", + // other fields omitted for brevity + ) + } +``` + +#### Log-message-as-plain-String API calls, parameterized + +```kotlin +// not implemented by KLogger, throws exception +fun trace(msg: String?, arg: Any?): Unit +fun debug(msg: String?, arg: Any?): Unit +fun info(msg: String?, arg: Any?): Unit +fun warn(msg: String?, arg: Any?): Unit +fun error(msg: String?, arg: Any?): Unit + +// not implemented by KLogger, throws exception +fun trace(msg: String?, arg1: Any?, arg2: Any?): Unit +fun debug(msg: String?, arg1: Any?, arg2: Any?): Unit +fun info(msg: String?, arg1: Any?, arg2: Any?): Unit +fun warn(msg: String?, arg1: Any?, arg2: Any?): Unit +fun error(msg: String?, arg1: Any?, arg2: Any?): Unit + +// not implemented by KLogger, throws exception +fun trace(msg: String?, vararg arguments: Any?): Unit +fun debug(msg: String?, vararg arguments: Any?): Unit +fun info(msg: String?, vararg arguments: Any?): Unit +fun warn(msg: String?, vararg arguments: Any?): Unit +fun error(msg: String?, vararg arguments: Any?): Unit + +// not implemented by KLogger, throws exception +fun trace(marker: Marker?, msg: String?, arg: Any?): Unit +fun debug(marker: Marker?, msg: String?, arg: Any?): Unit +fun info(marker: Marker?, msg: String?, arg: Any?): Unit +fun warn(marker: Marker?, msg: String?, arg: Any?): Unit +fun error(marker: Marker?, msg: String?, arg: Any?): Unit + +// not implemented by KLogger, throws exception +fun trace(marker: Marker?, msg: String?, arg1: Any?, arg2: Any?): Unit +fun debug(marker: Marker?, msg: String?, arg1: Any?, arg2: Any?): Unit +fun info(marker: Marker?, msg: String?, arg1: Any?, arg2: Any?): Unit +fun warn(marker: Marker?, msg: String?, arg1: Any?, arg2: Any?): Unit +fun error(marker: Marker?, msg: String?, arg1: Any?, arg2: Any?): Unit + +// not implemented by KLogger, throws exception +fun trace(marker: Marker?, msg: String?, vararg arguments: Any?): Unit +fun debug(marker: Marker?, msg: String?, vararg arguments: Any?): Unit +fun info(marker: Marker?, msg: String?, vararg arguments: Any?): Unit +fun warn(marker: Marker?, msg: String?, vararg arguments: Any?): Unit +fun error(marker: Marker?, msg: String?, vararg arguments: Any?): Unit +``` + +These API calls are actually not implemented by `KLogger` and without the compiler plugin they will throw an exception at runtime. +The plugin will transform them also to the `at` API with the compiler data filled in. It will also merge the message template +with the argument values and will extract `Throwable` if possible. + +```kotlin + logger.at(Level.TRACE|DEBUG|INFO|WARN|ERROR) { + message = "" + cause = lastArgument?.castToThrowable() + internalCompilerData = KLoggingEventBuilder.InternalCompilerData( + messageTemplate = "", + // other fields omitted for brevity + ) + } +``` + +#### Specialized API calls (entry/exit, throwing/catching) + +```kotlin +fun entry(vararg arguments: Any?): Unit +fun exit(): Unit +fun exit(result: T): T where T : Any? +fun throwing(throwable: T): T where T : Throwable +fun catching(throwable: T) where T : Throwable +``` + +As some of these methods return a value then we do not delegate these calls to the `at` API (as that function does not return a value). +Instead, we transform to overloaded `*WithCompilerData` (extension) API calls with the extra compiler data filled in: + +```kotlin +fun KLogger.entryWithCompilerData(compilerData: KLoggingEventBuilder.InternalCompilerData? = null, vararg arguments: Any?): Unit +fun KLogger.exitWithCompilerData(compilerData: KLoggingEventBuilder.InternalCompilerData? = null): Unit +fun KLogger.exitWithCompilerData(compilerData: KLoggingEventBuilder.InternalCompilerData? = null, result: T): T where T : Any? +fun KLogger.throwingWithCompilerData(compilerData: KLoggingEventBuilder.InternalCompilerData? = null, throwable: T): T where T : Throwable +fun KLogger.catchingWithCompilerData(compilerData: KLoggingEventBuilder.InternalCompilerData? = null, throwable: T) where T : Throwable +``` + +#### isEnabled API calls + +```kotlin +fun isTraceEnabled(marker: Marker? = null): Boolean +fun isDebugEnabled(marker: Marker? = null): Boolean +fun isInfoEnabled(marker: Marker? = null): Boolean +fun isWarnEnabled(marker: Marker? = null): Boolean +fun isErrorEnabled(marker: Marker? = null): Boolean +fun isLoggingOff(marker: Marker? = null): Boolean +fun isLoggingEnabledFor(level: Level, marker: Marker? = null): Boolean + +val isTraceEnabled: Boolean +val isDebugEnabled: Boolean +val isInfoEnabled: Boolean +val isWarnEnabled: Boolean +val isErrorEnabled: Boolean +val isLoggingOff: Boolean +``` + +These remain unchanged. diff --git a/kotlin-ir-plugin/build.gradle.kts b/kotlin-ir-plugin/build.gradle.kts new file mode 100644 index 00000000..fb5860c2 --- /dev/null +++ b/kotlin-ir-plugin/build.gradle.kts @@ -0,0 +1,51 @@ +import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL + +plugins { + kotlin("jvm") + kotlin("kapt") + id("com.github.gmazzo.buildconfig") + id("com.diffplug.spotless") + +} +repositories { + mavenCentral() +} + +dependencies { + compileOnly("org.jetbrains.kotlin:kotlin-compiler-embeddable") + + kapt("com.google.auto.service:auto-service:1.1.1") + compileOnly("com.google.auto.service:auto-service-annotations:1.1.1") + implementation("com.javiersc.kotlin:kotlin-compiler-extensions:0.4.4+2.0.21") + + testImplementation(kotlin("test-junit")) + testImplementation("org.junit.jupiter:junit-jupiter:5.11.3") + testImplementation("org.jetbrains.kotlin:kotlin-compiler-embeddable") + testImplementation("dev.zacsweers.kctfork:core:0.5.1") + testImplementation(rootProject) + testImplementation("ch.qos.logback:logback-classic:${rootProject.extra["logback_version"]}") +} + +buildConfig { + packageName("${rootProject.extra["kotlin_plugin_package_name"]}") + buildConfigField("String", "KOTLIN_PLUGIN_ID", "\"${rootProject.extra["kotlin_plugin_id"]}\"") +} + +tasks { + withType { + useJUnitPlatform() + testLogging { + showStandardStreams = true + showExceptions = true + exceptionFormat = FULL + } + } +} + +// Static code analysis tools +spotless { + kotlin { + target("src/**/*.kt") + ktfmt("0.47").googleStyle() + } +} diff --git a/kotlin-ir-plugin/code-samples-from-tests.md b/kotlin-ir-plugin/code-samples-from-tests.md new file mode 100644 index 00000000..61ccf38c --- /dev/null +++ b/kotlin-ir-plugin/code-samples-from-tests.md @@ -0,0 +1,146488 @@ +# Code samples from tests + +All the test cases that the plugin is tested against with before+after code snippets and how different feature +flags affect the transformation. Organized on the top level by feature flags and then by groups of test cases. + +
featureFlag=DEFAULT + +
with class=true + +
entry/exit API + +### entry(argument1, argument2) at MainTest.main(test1.kt:10) test + +User code: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) + } + +} +``` + +Transformed into: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entryWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "entry(argument1, argument2)", className = "test1.MainTest", methodName = "main", fileName = "test1.kt", lineNumber = 10)) + } + +} +``` + +### exit(resultValue) at MainTest.main(test2.kt:10) test + +User code: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) + } + +} +``` + +Transformed into: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "exit(resultValue)", className = "test2.MainTest", methodName = "main", fileName = "test2.kt", lineNumber = 10)) + } + +} +``` + +### exit() at MainTest.main(test3.kt:10) test + +User code: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() + } + +} +``` + +Transformed into: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(className = "test3.MainTest", methodName = "main", fileName = "test3.kt", lineNumber = 10)) + } + +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at MainTest.main(test4.kt:10) test + +User code: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) + } + +} +``` + +Transformed into: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "throwing(throwable)", className = "test4.MainTest", methodName = "main", fileName = "test4.kt", lineNumber = 10), throwable) + } + +} +``` + +### catching(throwable) at MainTest.main(test5.kt:10) test + +User code: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) + } + +} +``` + +Transformed into: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catchingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "catching(throwable)", className = "test5.MainTest", methodName = "main", fileName = "test5.kt", lineNumber = 10), throwable) + } + +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at MainTest.main(test6.kt:10) test + +User code: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test6.MainTest", methodName = "main", fileName = "test6.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test7.kt:10) test + +User code: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test7.MainTest", methodName = "main", fileName = "test7.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test8.kt:10) test + +User code: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test8.MainTest", methodName = "main", fileName = "test8.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at MainTest.main(test9.kt:10) test + +User code: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test9.MainTest", methodName = "main", fileName = "test9.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at MainTest.main(test10.kt:10) test + +User code: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test10.MainTest", methodName = "main", fileName = "test10.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test11.kt:10) test + +User code: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test11.MainTest", methodName = "main", fileName = "test11.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at MainTest.main(test12.kt:10) test + +User code: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test12.MainTest", methodName = "main", fileName = "test12.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at MainTest.main(test13.kt:10) test + +User code: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test13.MainTest", methodName = "main", fileName = "test13.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at MainTest.main(test14.kt:10) test + +User code: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test14.MainTest", methodName = "main", fileName = "test14.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test15.kt:10) test + +User code: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test15.MainTest", methodName = "main", fileName = "test15.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test16.kt:10) test + +User code: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test16.MainTest", methodName = "main", fileName = "test16.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test17.kt:10) test + +User code: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test17.MainTest", methodName = "main", fileName = "test17.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test18.kt:10) test + +User code: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test18.MainTest", methodName = "main", fileName = "test18.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test19.kt:10) test + +User code: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test19.MainTest", methodName = "main", fileName = "test19.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test20.kt:10) test + +User code: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test20.MainTest", methodName = "main", fileName = "test20.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test21.kt:10) test + +User code: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test21.MainTest", methodName = "main", fileName = "test21.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at MainTest.main(test22.kt:10) test + +User code: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test22.MainTest", methodName = "main", fileName = "test22.kt", lineNumber = 10) + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test23.kt:10) test + +User code: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test23.MainTest", methodName = "main", fileName = "test23.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test24.kt:10) test + +User code: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test24.MainTest", methodName = "main", fileName = "test24.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}", throwable) at MainTest.main(test28.kt:10) test + +User code: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test28.MainTest", methodName = "main", fileName = "test28.kt", lineNumber = 10) + } + +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at MainTest.main(test29.kt:10) test + +User code: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test29.MainTest", methodName = "main", fileName = "test29.kt", lineNumber = 10) + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at MainTest.main(test30.kt:10) test + +User code: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test30.MainTest", methodName = "main", fileName = "test30.kt", lineNumber = 10) + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test31.kt:10) test + +User code: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test31.MainTest", methodName = "main", fileName = "test31.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at MainTest.main(test32.kt:10) test + +User code: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test32.MainTest", methodName = "main", fileName = "test32.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test33.kt:10) test + +User code: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test33.MainTest", methodName = "main", fileName = "test33.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test34.kt:10) test + +User code: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test34.MainTest", methodName = "main", fileName = "test34.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test35.kt:10) test + +User code: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test35.MainTest", methodName = "main", fileName = "test35.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test36.kt:10) test + +User code: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test36.MainTest", methodName = "main", fileName = "test36.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test37.kt:10) test + +User code: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test37.MainTest", methodName = "main", fileName = "test37.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at MainTest.main(test38.kt:10) test + +User code: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test38.MainTest", methodName = "main", fileName = "test38.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test39.kt:10) test + +User code: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test39.MainTest", methodName = "main", fileName = "test39.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test40.kt:10) test + +User code: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test40.MainTest", methodName = "main", fileName = "test40.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at MainTest.main(test41.kt:10) test + +User code: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test41.MainTest", methodName = "main", fileName = "test41.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at MainTest.main(test42.kt:10) test + +User code: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test42.MainTest", methodName = "main", fileName = "test42.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test43.kt:10) test + +User code: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test43.MainTest", methodName = "main", fileName = "test43.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at MainTest.main(test44.kt:10) test + +User code: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test44.MainTest", methodName = "main", fileName = "test44.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test48.kt:10) test + +User code: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test48.MainTest", methodName = "main", fileName = "test48.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test49.kt:10) test + +User code: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test49.MainTest", methodName = "main", fileName = "test49.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test50.kt:10) test + +User code: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test50.MainTest", methodName = "main", fileName = "test50.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test51.kt:10) test + +User code: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test51.MainTest", methodName = "main", fileName = "test51.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test52.kt:10) test + +User code: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test52.MainTest", methodName = "main", fileName = "test52.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test53.kt:10) test + +User code: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test53.MainTest", methodName = "main", fileName = "test53.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at MainTest.main(test54.kt:10) test + +User code: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test54.MainTest", methodName = "main", fileName = "test54.kt", lineNumber = 10) + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test55.kt:10) test + +User code: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test55.MainTest", methodName = "main", fileName = "test55.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test56.kt:10) test + +User code: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test56.MainTest", methodName = "main", fileName = "test56.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}") at MainTest.main(test60.kt:10) test + +User code: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") + } + +} +``` + +Transformed into: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test60.MainTest", methodName = "main", fileName = "test60.kt", lineNumber = 10) + } + +} +``` + +
+ +### trace() { "trace messageBuilder" } at MainTest.main(test61.kt:10) test + +User code: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test61.MainTest", methodName = "main", fileName = "test61.kt", lineNumber = 10) + } + +} +``` + +### trace() { "trace messageBuilder $i" } at MainTest.main(test62.kt:10) test + +User code: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test62.MainTest", methodName = "main", fileName = "test62.kt", lineNumber = 10) + } + +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at MainTest.main(test63.kt:10) test + +User code: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test63.MainTest", methodName = "main", fileName = "test63.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at MainTest.main(test64.kt:10) test + +User code: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test64.MainTest", methodName = "main", fileName = "test64.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at MainTest.main(test65.kt:10) test + +User code: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test65.MainTest", methodName = "main", fileName = "test65.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test66.kt:10) test + +User code: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test66.MainTest", methodName = "main", fileName = "test66.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at MainTest.main(test67.kt:10) test + +User code: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test67.MainTest", methodName = "main", fileName = "test67.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test68.kt:10) test + +User code: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test68.MainTest", methodName = "main", fileName = "test68.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test69.kt:10) test + +User code: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test69.MainTest", methodName = "main", fileName = "test69.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at MainTest.main(test70.kt:10) test + +User code: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test70.MainTest", methodName = "main", fileName = "test70.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test71.kt:10) test + +User code: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test71.MainTest", methodName = "main", fileName = "test71.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test72.kt:10) test + +User code: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test72.MainTest", methodName = "main", fileName = "test72.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at MainTest.main(test73.kt:10) test + +User code: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test73.MainTest", methodName = "main", fileName = "test73.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at MainTest.main(test74.kt:10) test + +User code: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test74.MainTest", methodName = "main", fileName = "test74.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test75.kt:10) test + +User code: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test75.MainTest", methodName = "main", fileName = "test75.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at MainTest.main(test76.kt:10) test + +User code: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test76.MainTest", methodName = "main", fileName = "test76.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at MainTest.main(test77.kt:10) test + +User code: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test77.MainTest", methodName = "main", fileName = "test77.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at MainTest.main(test78.kt:10) test + +User code: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test78.MainTest", methodName = "main", fileName = "test78.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test79.kt:10) test + +User code: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test79.MainTest", methodName = "main", fileName = "test79.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test80.kt:10) test + +User code: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test80.MainTest", methodName = "main", fileName = "test80.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test81.kt:10) test + +User code: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test81.MainTest", methodName = "main", fileName = "test81.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test82.kt:10) test + +User code: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test82.MainTest", methodName = "main", fileName = "test82.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test83.kt:10) test + +User code: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test83.MainTest", methodName = "main", fileName = "test83.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test84.kt:10) test + +User code: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test84.MainTest", methodName = "main", fileName = "test84.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test85.kt:10) test + +User code: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test85.MainTest", methodName = "main", fileName = "test85.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at MainTest.main(test86.kt:10) test + +User code: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test86.MainTest", methodName = "main", fileName = "test86.kt", lineNumber = 10) + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test87.kt:10) test + +User code: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test87.MainTest", methodName = "main", fileName = "test87.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test88.kt:10) test + +User code: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test88.MainTest", methodName = "main", fileName = "test88.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}", throwable) at MainTest.main(test92.kt:10) test + +User code: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test92.MainTest", methodName = "main", fileName = "test92.kt", lineNumber = 10) + } + +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at MainTest.main(test93.kt:10) test + +User code: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test93.MainTest", methodName = "main", fileName = "test93.kt", lineNumber = 10) + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at MainTest.main(test94.kt:10) test + +User code: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test94.MainTest", methodName = "main", fileName = "test94.kt", lineNumber = 10) + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test95.kt:10) test + +User code: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test95.MainTest", methodName = "main", fileName = "test95.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at MainTest.main(test96.kt:10) test + +User code: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test96.MainTest", methodName = "main", fileName = "test96.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test97.kt:10) test + +User code: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test97.MainTest", methodName = "main", fileName = "test97.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test98.kt:10) test + +User code: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test98.MainTest", methodName = "main", fileName = "test98.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test99.kt:10) test + +User code: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test99.MainTest", methodName = "main", fileName = "test99.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test100.kt:10) test + +User code: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test100.MainTest", methodName = "main", fileName = "test100.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test101.kt:10) test + +User code: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test101.MainTest", methodName = "main", fileName = "test101.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at MainTest.main(test102.kt:10) test + +User code: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test102.MainTest", methodName = "main", fileName = "test102.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test103.kt:10) test + +User code: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test103.MainTest", methodName = "main", fileName = "test103.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test104.kt:10) test + +User code: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test104.MainTest", methodName = "main", fileName = "test104.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at MainTest.main(test105.kt:10) test + +User code: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test105.MainTest", methodName = "main", fileName = "test105.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at MainTest.main(test106.kt:10) test + +User code: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test106.MainTest", methodName = "main", fileName = "test106.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test107.kt:10) test + +User code: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test107.MainTest", methodName = "main", fileName = "test107.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at MainTest.main(test108.kt:10) test + +User code: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test108.MainTest", methodName = "main", fileName = "test108.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test112.kt:10) test + +User code: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test112.MainTest", methodName = "main", fileName = "test112.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test113.kt:10) test + +User code: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test113.MainTest", methodName = "main", fileName = "test113.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test114.kt:10) test + +User code: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test114.MainTest", methodName = "main", fileName = "test114.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test115.kt:10) test + +User code: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test115.MainTest", methodName = "main", fileName = "test115.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test116.kt:10) test + +User code: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test116.MainTest", methodName = "main", fileName = "test116.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test117.kt:10) test + +User code: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test117.MainTest", methodName = "main", fileName = "test117.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at MainTest.main(test118.kt:10) test + +User code: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test118.MainTest", methodName = "main", fileName = "test118.kt", lineNumber = 10) + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test119.kt:10) test + +User code: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test119.MainTest", methodName = "main", fileName = "test119.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test120.kt:10) test + +User code: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test120.MainTest", methodName = "main", fileName = "test120.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}") at MainTest.main(test124.kt:10) test + +User code: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") + } + +} +``` + +Transformed into: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test124.MainTest", methodName = "main", fileName = "test124.kt", lineNumber = 10) + } + +} +``` + +
+ +### debug() { "debug messageBuilder" } at MainTest.main(test125.kt:10) test + +User code: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test125.MainTest", methodName = "main", fileName = "test125.kt", lineNumber = 10) + } + +} +``` + +### debug() { "debug messageBuilder $i" } at MainTest.main(test126.kt:10) test + +User code: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test126.MainTest", methodName = "main", fileName = "test126.kt", lineNumber = 10) + } + +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at MainTest.main(test127.kt:10) test + +User code: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test127.MainTest", methodName = "main", fileName = "test127.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at MainTest.main(test128.kt:10) test + +User code: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test128.MainTest", methodName = "main", fileName = "test128.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at MainTest.main(test129.kt:10) test + +User code: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test129.MainTest", methodName = "main", fileName = "test129.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test130.kt:10) test + +User code: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test130.MainTest", methodName = "main", fileName = "test130.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at MainTest.main(test131.kt:10) test + +User code: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test131.MainTest", methodName = "main", fileName = "test131.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test132.kt:10) test + +User code: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test132.MainTest", methodName = "main", fileName = "test132.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test133.kt:10) test + +User code: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test133.MainTest", methodName = "main", fileName = "test133.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at MainTest.main(test134.kt:10) test + +User code: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test134.MainTest", methodName = "main", fileName = "test134.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test135.kt:10) test + +User code: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test135.MainTest", methodName = "main", fileName = "test135.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test136.kt:10) test + +User code: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test136.MainTest", methodName = "main", fileName = "test136.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at MainTest.main(test137.kt:10) test + +User code: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test137.MainTest", methodName = "main", fileName = "test137.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at MainTest.main(test138.kt:10) test + +User code: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test138.MainTest", methodName = "main", fileName = "test138.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test139.kt:10) test + +User code: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test139.MainTest", methodName = "main", fileName = "test139.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at MainTest.main(test140.kt:10) test + +User code: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test140.MainTest", methodName = "main", fileName = "test140.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at MainTest.main(test141.kt:10) test + +User code: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test141.MainTest", methodName = "main", fileName = "test141.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at MainTest.main(test142.kt:10) test + +User code: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test142.MainTest", methodName = "main", fileName = "test142.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test143.kt:10) test + +User code: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test143.MainTest", methodName = "main", fileName = "test143.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test144.kt:10) test + +User code: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test144.MainTest", methodName = "main", fileName = "test144.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test145.kt:10) test + +User code: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test145.MainTest", methodName = "main", fileName = "test145.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test146.kt:10) test + +User code: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test146.MainTest", methodName = "main", fileName = "test146.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test147.kt:10) test + +User code: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test147.MainTest", methodName = "main", fileName = "test147.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test148.kt:10) test + +User code: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test148.MainTest", methodName = "main", fileName = "test148.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test149.kt:10) test + +User code: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test149.MainTest", methodName = "main", fileName = "test149.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at MainTest.main(test150.kt:10) test + +User code: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test150.MainTest", methodName = "main", fileName = "test150.kt", lineNumber = 10) + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test151.kt:10) test + +User code: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test151.MainTest", methodName = "main", fileName = "test151.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test152.kt:10) test + +User code: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test152.MainTest", methodName = "main", fileName = "test152.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}", throwable) at MainTest.main(test156.kt:10) test + +User code: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test156.MainTest", methodName = "main", fileName = "test156.kt", lineNumber = 10) + } + +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at MainTest.main(test157.kt:10) test + +User code: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test157.MainTest", methodName = "main", fileName = "test157.kt", lineNumber = 10) + } + +} +``` + +### info(throwable) { "info messageBuilder $i" } at MainTest.main(test158.kt:10) test + +User code: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test158.MainTest", methodName = "main", fileName = "test158.kt", lineNumber = 10) + } + +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test159.kt:10) test + +User code: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test159.MainTest", methodName = "main", fileName = "test159.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at MainTest.main(test160.kt:10) test + +User code: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test160.MainTest", methodName = "main", fileName = "test160.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test161.kt:10) test + +User code: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test161.MainTest", methodName = "main", fileName = "test161.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test162.kt:10) test + +User code: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test162.MainTest", methodName = "main", fileName = "test162.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at MainTest.main(test163.kt:10) test + +User code: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test163.MainTest", methodName = "main", fileName = "test163.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test164.kt:10) test + +User code: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test164.MainTest", methodName = "main", fileName = "test164.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test165.kt:10) test + +User code: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test165.MainTest", methodName = "main", fileName = "test165.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at MainTest.main(test166.kt:10) test + +User code: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test166.MainTest", methodName = "main", fileName = "test166.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test167.kt:10) test + +User code: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test167.MainTest", methodName = "main", fileName = "test167.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test168.kt:10) test + +User code: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test168.MainTest", methodName = "main", fileName = "test168.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at MainTest.main(test169.kt:10) test + +User code: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test169.MainTest", methodName = "main", fileName = "test169.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at MainTest.main(test170.kt:10) test + +User code: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test170.MainTest", methodName = "main", fileName = "test170.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test171.kt:10) test + +User code: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test171.MainTest", methodName = "main", fileName = "test171.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at MainTest.main(test172.kt:10) test + +User code: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test172.MainTest", methodName = "main", fileName = "test172.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at MainTest.main(test176.kt:10) test + +User code: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test176.MainTest", methodName = "main", fileName = "test176.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test177.kt:10) test + +User code: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test177.MainTest", methodName = "main", fileName = "test177.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test178.kt:10) test + +User code: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test178.MainTest", methodName = "main", fileName = "test178.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at MainTest.main(test179.kt:10) test + +User code: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test179.MainTest", methodName = "main", fileName = "test179.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test180.kt:10) test + +User code: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test180.MainTest", methodName = "main", fileName = "test180.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test181.kt:10) test + +User code: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test181.MainTest", methodName = "main", fileName = "test181.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at MainTest.main(test182.kt:10) test + +User code: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test182.MainTest", methodName = "main", fileName = "test182.kt", lineNumber = 10) + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test183.kt:10) test + +User code: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test183.MainTest", methodName = "main", fileName = "test183.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test184.kt:10) test + +User code: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test184.MainTest", methodName = "main", fileName = "test184.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}") at MainTest.main(test188.kt:10) test + +User code: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") + } + +} +``` + +Transformed into: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test188.MainTest", methodName = "main", fileName = "test188.kt", lineNumber = 10) + } + +} +``` + +
+ +### info() { "info messageBuilder" } at MainTest.main(test189.kt:10) test + +User code: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test189.MainTest", methodName = "main", fileName = "test189.kt", lineNumber = 10) + } + +} +``` + +### info() { "info messageBuilder $i" } at MainTest.main(test190.kt:10) test + +User code: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test190.MainTest", methodName = "main", fileName = "test190.kt", lineNumber = 10) + } + +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at MainTest.main(test191.kt:10) test + +User code: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test191.MainTest", methodName = "main", fileName = "test191.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=null } at MainTest.main(test192.kt:10) test + +User code: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test192.MainTest", methodName = "main", fileName = "test192.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at MainTest.main(test193.kt:10) test + +User code: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test193.MainTest", methodName = "main", fileName = "test193.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test194.kt:10) test + +User code: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test194.MainTest", methodName = "main", fileName = "test194.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at MainTest.main(test195.kt:10) test + +User code: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test195.MainTest", methodName = "main", fileName = "test195.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at MainTest.main(test196.kt:10) test + +User code: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test196.MainTest", methodName = "main", fileName = "test196.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test197.kt:10) test + +User code: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test197.MainTest", methodName = "main", fileName = "test197.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at MainTest.main(test198.kt:10) test + +User code: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test198.MainTest", methodName = "main", fileName = "test198.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test199.kt:10) test + +User code: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test199.MainTest", methodName = "main", fileName = "test199.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test200.kt:10) test + +User code: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test200.MainTest", methodName = "main", fileName = "test200.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at MainTest.main(test201.kt:10) test + +User code: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test201.MainTest", methodName = "main", fileName = "test201.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at MainTest.main(test202.kt:10) test + +User code: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test202.MainTest", methodName = "main", fileName = "test202.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test203.kt:10) test + +User code: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test203.MainTest", methodName = "main", fileName = "test203.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at MainTest.main(test204.kt:10) test + +User code: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test204.MainTest", methodName = "main", fileName = "test204.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at MainTest.main(test205.kt:10) test + +User code: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test205.MainTest", methodName = "main", fileName = "test205.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at MainTest.main(test206.kt:10) test + +User code: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test206.MainTest", methodName = "main", fileName = "test206.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test207.kt:10) test + +User code: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test207.MainTest", methodName = "main", fileName = "test207.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test208.kt:10) test + +User code: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test208.MainTest", methodName = "main", fileName = "test208.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test209.kt:10) test + +User code: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test209.MainTest", methodName = "main", fileName = "test209.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test210.kt:10) test + +User code: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test210.MainTest", methodName = "main", fileName = "test210.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test211.kt:10) test + +User code: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test211.MainTest", methodName = "main", fileName = "test211.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test212.kt:10) test + +User code: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test212.MainTest", methodName = "main", fileName = "test212.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test213.kt:10) test + +User code: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test213.MainTest", methodName = "main", fileName = "test213.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at MainTest.main(test214.kt:10) test + +User code: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test214.MainTest", methodName = "main", fileName = "test214.kt", lineNumber = 10) + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test215.kt:10) test + +User code: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test215.MainTest", methodName = "main", fileName = "test215.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test216.kt:10) test + +User code: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test216.MainTest", methodName = "main", fileName = "test216.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}", throwable) at MainTest.main(test220.kt:10) test + +User code: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test220.MainTest", methodName = "main", fileName = "test220.kt", lineNumber = 10) + } + +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at MainTest.main(test221.kt:10) test + +User code: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test221.MainTest", methodName = "main", fileName = "test221.kt", lineNumber = 10) + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at MainTest.main(test222.kt:10) test + +User code: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test222.MainTest", methodName = "main", fileName = "test222.kt", lineNumber = 10) + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test223.kt:10) test + +User code: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test223.MainTest", methodName = "main", fileName = "test223.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at MainTest.main(test224.kt:10) test + +User code: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test224.MainTest", methodName = "main", fileName = "test224.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test225.kt:10) test + +User code: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test225.MainTest", methodName = "main", fileName = "test225.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test226.kt:10) test + +User code: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test226.MainTest", methodName = "main", fileName = "test226.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test227.kt:10) test + +User code: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test227.MainTest", methodName = "main", fileName = "test227.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test228.kt:10) test + +User code: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test228.MainTest", methodName = "main", fileName = "test228.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test229.kt:10) test + +User code: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test229.MainTest", methodName = "main", fileName = "test229.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at MainTest.main(test230.kt:10) test + +User code: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test230.MainTest", methodName = "main", fileName = "test230.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test231.kt:10) test + +User code: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test231.MainTest", methodName = "main", fileName = "test231.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test232.kt:10) test + +User code: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test232.MainTest", methodName = "main", fileName = "test232.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at MainTest.main(test233.kt:10) test + +User code: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test233.MainTest", methodName = "main", fileName = "test233.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at MainTest.main(test234.kt:10) test + +User code: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test234.MainTest", methodName = "main", fileName = "test234.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test235.kt:10) test + +User code: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test235.MainTest", methodName = "main", fileName = "test235.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at MainTest.main(test236.kt:10) test + +User code: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test236.MainTest", methodName = "main", fileName = "test236.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test240.kt:10) test + +User code: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test240.MainTest", methodName = "main", fileName = "test240.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test241.kt:10) test + +User code: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test241.MainTest", methodName = "main", fileName = "test241.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test242.kt:10) test + +User code: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test242.MainTest", methodName = "main", fileName = "test242.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test243.kt:10) test + +User code: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test243.MainTest", methodName = "main", fileName = "test243.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test244.kt:10) test + +User code: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test244.MainTest", methodName = "main", fileName = "test244.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test245.kt:10) test + +User code: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test245.MainTest", methodName = "main", fileName = "test245.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at MainTest.main(test246.kt:10) test + +User code: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test246.MainTest", methodName = "main", fileName = "test246.kt", lineNumber = 10) + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test247.kt:10) test + +User code: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test247.MainTest", methodName = "main", fileName = "test247.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test248.kt:10) test + +User code: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test248.MainTest", methodName = "main", fileName = "test248.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}") at MainTest.main(test252.kt:10) test + +User code: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") + } + +} +``` + +Transformed into: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test252.MainTest", methodName = "main", fileName = "test252.kt", lineNumber = 10) + } + +} +``` + +
+ +### warn() { "warn messageBuilder" } at MainTest.main(test253.kt:10) test + +User code: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test253.MainTest", methodName = "main", fileName = "test253.kt", lineNumber = 10) + } + +} +``` + +### warn() { "warn messageBuilder $i" } at MainTest.main(test254.kt:10) test + +User code: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test254.MainTest", methodName = "main", fileName = "test254.kt", lineNumber = 10) + } + +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at MainTest.main(test255.kt:10) test + +User code: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test255.MainTest", methodName = "main", fileName = "test255.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at MainTest.main(test256.kt:10) test + +User code: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test256.MainTest", methodName = "main", fileName = "test256.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at MainTest.main(test257.kt:10) test + +User code: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test257.MainTest", methodName = "main", fileName = "test257.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test258.kt:10) test + +User code: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test258.MainTest", methodName = "main", fileName = "test258.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at MainTest.main(test259.kt:10) test + +User code: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test259.MainTest", methodName = "main", fileName = "test259.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test260.kt:10) test + +User code: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test260.MainTest", methodName = "main", fileName = "test260.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test261.kt:10) test + +User code: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test261.MainTest", methodName = "main", fileName = "test261.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at MainTest.main(test262.kt:10) test + +User code: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test262.MainTest", methodName = "main", fileName = "test262.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test263.kt:10) test + +User code: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test263.MainTest", methodName = "main", fileName = "test263.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test264.kt:10) test + +User code: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test264.MainTest", methodName = "main", fileName = "test264.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at MainTest.main(test265.kt:10) test + +User code: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test265.MainTest", methodName = "main", fileName = "test265.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at MainTest.main(test266.kt:10) test + +User code: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test266.MainTest", methodName = "main", fileName = "test266.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test267.kt:10) test + +User code: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test267.MainTest", methodName = "main", fileName = "test267.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at MainTest.main(test268.kt:10) test + +User code: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test268.MainTest", methodName = "main", fileName = "test268.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at MainTest.main(test269.kt:10) test + +User code: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test269.MainTest", methodName = "main", fileName = "test269.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at MainTest.main(test270.kt:10) test + +User code: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test270.MainTest", methodName = "main", fileName = "test270.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test271.kt:10) test + +User code: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test271.MainTest", methodName = "main", fileName = "test271.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test272.kt:10) test + +User code: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test272.MainTest", methodName = "main", fileName = "test272.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test273.kt:10) test + +User code: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test273.MainTest", methodName = "main", fileName = "test273.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test274.kt:10) test + +User code: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test274.MainTest", methodName = "main", fileName = "test274.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test275.kt:10) test + +User code: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test275.MainTest", methodName = "main", fileName = "test275.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test276.kt:10) test + +User code: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test276.MainTest", methodName = "main", fileName = "test276.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test277.kt:10) test + +User code: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test277.MainTest", methodName = "main", fileName = "test277.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at MainTest.main(test278.kt:10) test + +User code: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test278.MainTest", methodName = "main", fileName = "test278.kt", lineNumber = 10) + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test279.kt:10) test + +User code: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test279.MainTest", methodName = "main", fileName = "test279.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test280.kt:10) test + +User code: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test280.MainTest", methodName = "main", fileName = "test280.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}", throwable) at MainTest.main(test284.kt:10) test + +User code: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test284.MainTest", methodName = "main", fileName = "test284.kt", lineNumber = 10) + } + +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at MainTest.main(test285.kt:10) test + +User code: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test285.MainTest", methodName = "main", fileName = "test285.kt", lineNumber = 10) + } + +} +``` + +### error(throwable) { "error messageBuilder $i" } at MainTest.main(test286.kt:10) test + +User code: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test286.MainTest", methodName = "main", fileName = "test286.kt", lineNumber = 10) + } + +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test287.kt:10) test + +User code: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test287.MainTest", methodName = "main", fileName = "test287.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=throwable } at MainTest.main(test288.kt:10) test + +User code: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test288.MainTest", methodName = "main", fileName = "test288.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test289.kt:10) test + +User code: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test289.MainTest", methodName = "main", fileName = "test289.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test290.kt:10) test + +User code: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test290.MainTest", methodName = "main", fileName = "test290.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at MainTest.main(test291.kt:10) test + +User code: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test291.MainTest", methodName = "main", fileName = "test291.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test292.kt:10) test + +User code: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test292.MainTest", methodName = "main", fileName = "test292.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test293.kt:10) test + +User code: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test293.MainTest", methodName = "main", fileName = "test293.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at MainTest.main(test294.kt:10) test + +User code: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test294.MainTest", methodName = "main", fileName = "test294.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test295.kt:10) test + +User code: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test295.MainTest", methodName = "main", fileName = "test295.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test296.kt:10) test + +User code: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test296.MainTest", methodName = "main", fileName = "test296.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at MainTest.main(test297.kt:10) test + +User code: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test297.MainTest", methodName = "main", fileName = "test297.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at MainTest.main(test298.kt:10) test + +User code: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test298.MainTest", methodName = "main", fileName = "test298.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test299.kt:10) test + +User code: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test299.MainTest", methodName = "main", fileName = "test299.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at MainTest.main(test300.kt:10) test + +User code: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test300.MainTest", methodName = "main", fileName = "test300.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at MainTest.main(test304.kt:10) test + +User code: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test304.MainTest", methodName = "main", fileName = "test304.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test305.kt:10) test + +User code: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test305.MainTest", methodName = "main", fileName = "test305.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test306.kt:10) test + +User code: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test306.MainTest", methodName = "main", fileName = "test306.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at MainTest.main(test307.kt:10) test + +User code: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test307.MainTest", methodName = "main", fileName = "test307.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test308.kt:10) test + +User code: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test308.MainTest", methodName = "main", fileName = "test308.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test309.kt:10) test + +User code: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test309.MainTest", methodName = "main", fileName = "test309.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at MainTest.main(test310.kt:10) test + +User code: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test310.MainTest", methodName = "main", fileName = "test310.kt", lineNumber = 10) + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test311.kt:10) test + +User code: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test311.MainTest", methodName = "main", fileName = "test311.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test312.kt:10) test + +User code: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test312.MainTest", methodName = "main", fileName = "test312.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}") at MainTest.main(test316.kt:10) test + +User code: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") + } + +} +``` + +Transformed into: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test316.MainTest", methodName = "main", fileName = "test316.kt", lineNumber = 10) + } + +} +``` + +
+ +### error() { "error messageBuilder" } at MainTest.main(test317.kt:10) test + +User code: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test317.MainTest", methodName = "main", fileName = "test317.kt", lineNumber = 10) + } + +} +``` + +### error() { "error messageBuilder $i" } at MainTest.main(test318.kt:10) test + +User code: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test318.MainTest", methodName = "main", fileName = "test318.kt", lineNumber = 10) + } + +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at MainTest.main(test319.kt:10) test + +User code: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test319.MainTest", methodName = "main", fileName = "test319.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=null } at MainTest.main(test320.kt:10) test + +User code: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test320.MainTest", methodName = "main", fileName = "test320.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at MainTest.main(test321.kt:10) test + +User code: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test321.MainTest", methodName = "main", fileName = "test321.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test322.kt:10) test + +User code: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test322.MainTest", methodName = "main", fileName = "test322.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at MainTest.main(test323.kt:10) test + +User code: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test323.MainTest", methodName = "main", fileName = "test323.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at MainTest.main(test324.kt:10) test + +User code: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test324.MainTest", methodName = "main", fileName = "test324.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test325.kt:10) test + +User code: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test325.MainTest", methodName = "main", fileName = "test325.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
+ +
with class=false + +
entry/exit API + +### entry(argument1, argument2) at Test326Kt.main(test326.kt:10) test + +User code: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) +} +``` + +Transformed into: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entryWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "entry(argument1, argument2)", className = "test326.Test326Kt", methodName = "main", fileName = "test326.kt", lineNumber = 10)) +} +``` + +### exit(resultValue) at Test327Kt.main(test327.kt:10) test + +User code: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) +} +``` + +Transformed into: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "exit(resultValue)", className = "test327.Test327Kt", methodName = "main", fileName = "test327.kt", lineNumber = 10)) +} +``` + +### exit() at Test328Kt.main(test328.kt:10) test + +User code: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() +} +``` + +Transformed into: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(className = "test328.Test328Kt", methodName = "main", fileName = "test328.kt", lineNumber = 10)) +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at Test329Kt.main(test329.kt:10) test + +User code: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) +} +``` + +Transformed into: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "throwing(throwable)", className = "test329.Test329Kt", methodName = "main", fileName = "test329.kt", lineNumber = 10), throwable) +} +``` + +### catching(throwable) at Test330Kt.main(test330.kt:10) test + +User code: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) +} +``` + +Transformed into: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catchingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "catching(throwable)", className = "test330.Test330Kt", methodName = "main", fileName = "test330.kt", lineNumber = 10), throwable) +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at Test331Kt.main(test331.kt:10) test + +User code: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test331.Test331Kt", methodName = "main", fileName = "test331.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test332Kt.main(test332.kt:10) test + +User code: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test332.Test332Kt", methodName = "main", fileName = "test332.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test333Kt.main(test333.kt:10) test + +User code: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test333.Test333Kt", methodName = "main", fileName = "test333.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at Test334Kt.main(test334.kt:10) test + +User code: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test334.Test334Kt", methodName = "main", fileName = "test334.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at Test335Kt.main(test335.kt:10) test + +User code: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test335.Test335Kt", methodName = "main", fileName = "test335.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at Test336Kt.main(test336.kt:10) test + +User code: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test336.Test336Kt", methodName = "main", fileName = "test336.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at Test337Kt.main(test337.kt:10) test + +User code: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test337.Test337Kt", methodName = "main", fileName = "test337.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at Test338Kt.main(test338.kt:10) test + +User code: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test338.Test338Kt", methodName = "main", fileName = "test338.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at Test339Kt.main(test339.kt:10) test + +User code: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test339.Test339Kt", methodName = "main", fileName = "test339.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at Test340Kt.main(test340.kt:10) test + +User code: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test340.Test340Kt", methodName = "main", fileName = "test340.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at Test341Kt.main(test341.kt:10) test + +User code: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test341.Test341Kt", methodName = "main", fileName = "test341.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at Test342Kt.main(test342.kt:10) test + +User code: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test342.Test342Kt", methodName = "main", fileName = "test342.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test343Kt.main(test343.kt:10) test + +User code: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test343.Test343Kt", methodName = "main", fileName = "test343.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at Test344Kt.main(test344.kt:10) test + +User code: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test344.Test344Kt", methodName = "main", fileName = "test344.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at Test345Kt.main(test345.kt:10) test + +User code: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test345.Test345Kt", methodName = "main", fileName = "test345.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test346Kt.main(test346.kt:10) test + +User code: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test346.Test346Kt", methodName = "main", fileName = "test346.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at Test347Kt.main(test347.kt:10) test + +User code: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test347.Test347Kt", methodName = "main", fileName = "test347.kt", lineNumber = 10) +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test348Kt.main(test348.kt:10) test + +User code: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test348.Test348Kt", methodName = "main", fileName = "test348.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test349Kt.main(test349.kt:10) test + +User code: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test349.Test349Kt", methodName = "main", fileName = "test349.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}", throwable) at Test353Kt.main(test353.kt:10) test + +User code: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test353.Test353Kt", methodName = "main", fileName = "test353.kt", lineNumber = 10) +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at Test354Kt.main(test354.kt:10) test + +User code: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test354.Test354Kt", methodName = "main", fileName = "test354.kt", lineNumber = 10) +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at Test355Kt.main(test355.kt:10) test + +User code: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test355.Test355Kt", methodName = "main", fileName = "test355.kt", lineNumber = 10) +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at Test356Kt.main(test356.kt:10) test + +User code: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test356.Test356Kt", methodName = "main", fileName = "test356.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at Test357Kt.main(test357.kt:10) test + +User code: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test357.Test357Kt", methodName = "main", fileName = "test357.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at Test358Kt.main(test358.kt:10) test + +User code: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test358.Test358Kt", methodName = "main", fileName = "test358.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test359Kt.main(test359.kt:10) test + +User code: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test359.Test359Kt", methodName = "main", fileName = "test359.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at Test360Kt.main(test360.kt:10) test + +User code: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test360.Test360Kt", methodName = "main", fileName = "test360.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at Test361Kt.main(test361.kt:10) test + +User code: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test361.Test361Kt", methodName = "main", fileName = "test361.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test362Kt.main(test362.kt:10) test + +User code: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test362.Test362Kt", methodName = "main", fileName = "test362.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at Test363Kt.main(test363.kt:10) test + +User code: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test363.Test363Kt", methodName = "main", fileName = "test363.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test364Kt.main(test364.kt:10) test + +User code: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test364.Test364Kt", methodName = "main", fileName = "test364.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test365Kt.main(test365.kt:10) test + +User code: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test365.Test365Kt", methodName = "main", fileName = "test365.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at Test366Kt.main(test366.kt:10) test + +User code: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test366.Test366Kt", methodName = "main", fileName = "test366.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at Test367Kt.main(test367.kt:10) test + +User code: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test367.Test367Kt", methodName = "main", fileName = "test367.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at Test368Kt.main(test368.kt:10) test + +User code: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test368.Test368Kt", methodName = "main", fileName = "test368.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at Test369Kt.main(test369.kt:10) test + +User code: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test369.Test369Kt", methodName = "main", fileName = "test369.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at Test373Kt.main(test373.kt:10) test + +User code: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test373.Test373Kt", methodName = "main", fileName = "test373.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at Test374Kt.main(test374.kt:10) test + +User code: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test374.Test374Kt", methodName = "main", fileName = "test374.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test375Kt.main(test375.kt:10) test + +User code: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test375.Test375Kt", methodName = "main", fileName = "test375.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at Test376Kt.main(test376.kt:10) test + +User code: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test376.Test376Kt", methodName = "main", fileName = "test376.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at Test377Kt.main(test377.kt:10) test + +User code: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test377.Test377Kt", methodName = "main", fileName = "test377.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test378Kt.main(test378.kt:10) test + +User code: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test378.Test378Kt", methodName = "main", fileName = "test378.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at Test379Kt.main(test379.kt:10) test + +User code: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) +} +``` + +Transformed into: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test379.Test379Kt", methodName = "main", fileName = "test379.kt", lineNumber = 10) +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test380Kt.main(test380.kt:10) test + +User code: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test380.Test380Kt", methodName = "main", fileName = "test380.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test381Kt.main(test381.kt:10) test + +User code: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test381.Test381Kt", methodName = "main", fileName = "test381.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}") at Test385Kt.main(test385.kt:10) test + +User code: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") +} +``` + +Transformed into: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test385.Test385Kt", methodName = "main", fileName = "test385.kt", lineNumber = 10) +} +``` + +
+ +### trace() { "trace messageBuilder" } at Test386Kt.main(test386.kt:10) test + +User code: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test386.Test386Kt", methodName = "main", fileName = "test386.kt", lineNumber = 10) +} +``` + +### trace() { "trace messageBuilder $i" } at Test387Kt.main(test387.kt:10) test + +User code: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test387.Test387Kt", methodName = "main", fileName = "test387.kt", lineNumber = 10) +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at Test388Kt.main(test388.kt:10) test + +User code: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test388.Test388Kt", methodName = "main", fileName = "test388.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at Test389Kt.main(test389.kt:10) test + +User code: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test389.Test389Kt", methodName = "main", fileName = "test389.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at Test390Kt.main(test390.kt:10) test + +User code: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test390.Test390Kt", methodName = "main", fileName = "test390.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at Test391Kt.main(test391.kt:10) test + +User code: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test391.Test391Kt", methodName = "main", fileName = "test391.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at Test392Kt.main(test392.kt:10) test + +User code: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test392.Test392Kt", methodName = "main", fileName = "test392.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at Test393Kt.main(test393.kt:10) test + +User code: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test393.Test393Kt", methodName = "main", fileName = "test393.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test394Kt.main(test394.kt:10) test + +User code: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test394.Test394Kt", methodName = "main", fileName = "test394.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at Test395Kt.main(test395.kt:10) test + +User code: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test395.Test395Kt", methodName = "main", fileName = "test395.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test396Kt.main(test396.kt:10) test + +User code: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test396.Test396Kt", methodName = "main", fileName = "test396.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test397Kt.main(test397.kt:10) test + +User code: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test397.Test397Kt", methodName = "main", fileName = "test397.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at Test398Kt.main(test398.kt:10) test + +User code: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test398.Test398Kt", methodName = "main", fileName = "test398.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at Test399Kt.main(test399.kt:10) test + +User code: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test399.Test399Kt", methodName = "main", fileName = "test399.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at Test400Kt.main(test400.kt:10) test + +User code: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test400.Test400Kt", methodName = "main", fileName = "test400.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at Test401Kt.main(test401.kt:10) test + +User code: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test401.Test401Kt", methodName = "main", fileName = "test401.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at Test402Kt.main(test402.kt:10) test + +User code: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test402.Test402Kt", methodName = "main", fileName = "test402.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at Test403Kt.main(test403.kt:10) test + +User code: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test403.Test403Kt", methodName = "main", fileName = "test403.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at Test404Kt.main(test404.kt:10) test + +User code: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test404.Test404Kt", methodName = "main", fileName = "test404.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at Test405Kt.main(test405.kt:10) test + +User code: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test405.Test405Kt", methodName = "main", fileName = "test405.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at Test406Kt.main(test406.kt:10) test + +User code: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test406.Test406Kt", methodName = "main", fileName = "test406.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test407Kt.main(test407.kt:10) test + +User code: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test407.Test407Kt", methodName = "main", fileName = "test407.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at Test408Kt.main(test408.kt:10) test + +User code: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test408.Test408Kt", methodName = "main", fileName = "test408.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at Test409Kt.main(test409.kt:10) test + +User code: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test409.Test409Kt", methodName = "main", fileName = "test409.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test410Kt.main(test410.kt:10) test + +User code: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test410.Test410Kt", methodName = "main", fileName = "test410.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at Test411Kt.main(test411.kt:10) test + +User code: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test411.Test411Kt", methodName = "main", fileName = "test411.kt", lineNumber = 10) +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test412Kt.main(test412.kt:10) test + +User code: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test412.Test412Kt", methodName = "main", fileName = "test412.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test413Kt.main(test413.kt:10) test + +User code: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test413.Test413Kt", methodName = "main", fileName = "test413.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}", throwable) at Test417Kt.main(test417.kt:10) test + +User code: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test417.Test417Kt", methodName = "main", fileName = "test417.kt", lineNumber = 10) +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at Test418Kt.main(test418.kt:10) test + +User code: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test418.Test418Kt", methodName = "main", fileName = "test418.kt", lineNumber = 10) +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at Test419Kt.main(test419.kt:10) test + +User code: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test419.Test419Kt", methodName = "main", fileName = "test419.kt", lineNumber = 10) +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at Test420Kt.main(test420.kt:10) test + +User code: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test420.Test420Kt", methodName = "main", fileName = "test420.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at Test421Kt.main(test421.kt:10) test + +User code: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test421.Test421Kt", methodName = "main", fileName = "test421.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at Test422Kt.main(test422.kt:10) test + +User code: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test422.Test422Kt", methodName = "main", fileName = "test422.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test423Kt.main(test423.kt:10) test + +User code: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test423.Test423Kt", methodName = "main", fileName = "test423.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at Test424Kt.main(test424.kt:10) test + +User code: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test424.Test424Kt", methodName = "main", fileName = "test424.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at Test425Kt.main(test425.kt:10) test + +User code: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test425.Test425Kt", methodName = "main", fileName = "test425.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test426Kt.main(test426.kt:10) test + +User code: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test426.Test426Kt", methodName = "main", fileName = "test426.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at Test427Kt.main(test427.kt:10) test + +User code: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test427.Test427Kt", methodName = "main", fileName = "test427.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test428Kt.main(test428.kt:10) test + +User code: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test428.Test428Kt", methodName = "main", fileName = "test428.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test429Kt.main(test429.kt:10) test + +User code: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test429.Test429Kt", methodName = "main", fileName = "test429.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at Test430Kt.main(test430.kt:10) test + +User code: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test430.Test430Kt", methodName = "main", fileName = "test430.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at Test431Kt.main(test431.kt:10) test + +User code: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test431.Test431Kt", methodName = "main", fileName = "test431.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at Test432Kt.main(test432.kt:10) test + +User code: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test432.Test432Kt", methodName = "main", fileName = "test432.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at Test433Kt.main(test433.kt:10) test + +User code: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test433.Test433Kt", methodName = "main", fileName = "test433.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at Test437Kt.main(test437.kt:10) test + +User code: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test437.Test437Kt", methodName = "main", fileName = "test437.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at Test438Kt.main(test438.kt:10) test + +User code: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test438.Test438Kt", methodName = "main", fileName = "test438.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test439Kt.main(test439.kt:10) test + +User code: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test439.Test439Kt", methodName = "main", fileName = "test439.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at Test440Kt.main(test440.kt:10) test + +User code: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test440.Test440Kt", methodName = "main", fileName = "test440.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at Test441Kt.main(test441.kt:10) test + +User code: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test441.Test441Kt", methodName = "main", fileName = "test441.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test442Kt.main(test442.kt:10) test + +User code: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test442.Test442Kt", methodName = "main", fileName = "test442.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at Test443Kt.main(test443.kt:10) test + +User code: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) +} +``` + +Transformed into: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test443.Test443Kt", methodName = "main", fileName = "test443.kt", lineNumber = 10) +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test444Kt.main(test444.kt:10) test + +User code: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test444.Test444Kt", methodName = "main", fileName = "test444.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test445Kt.main(test445.kt:10) test + +User code: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test445.Test445Kt", methodName = "main", fileName = "test445.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}") at Test449Kt.main(test449.kt:10) test + +User code: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") +} +``` + +Transformed into: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test449.Test449Kt", methodName = "main", fileName = "test449.kt", lineNumber = 10) +} +``` + +
+ +### debug() { "debug messageBuilder" } at Test450Kt.main(test450.kt:10) test + +User code: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test450.Test450Kt", methodName = "main", fileName = "test450.kt", lineNumber = 10) +} +``` + +### debug() { "debug messageBuilder $i" } at Test451Kt.main(test451.kt:10) test + +User code: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test451.Test451Kt", methodName = "main", fileName = "test451.kt", lineNumber = 10) +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at Test452Kt.main(test452.kt:10) test + +User code: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test452.Test452Kt", methodName = "main", fileName = "test452.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at Test453Kt.main(test453.kt:10) test + +User code: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test453.Test453Kt", methodName = "main", fileName = "test453.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at Test454Kt.main(test454.kt:10) test + +User code: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test454.Test454Kt", methodName = "main", fileName = "test454.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at Test455Kt.main(test455.kt:10) test + +User code: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test455.Test455Kt", methodName = "main", fileName = "test455.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at Test456Kt.main(test456.kt:10) test + +User code: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test456.Test456Kt", methodName = "main", fileName = "test456.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at Test457Kt.main(test457.kt:10) test + +User code: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test457.Test457Kt", methodName = "main", fileName = "test457.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test458Kt.main(test458.kt:10) test + +User code: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test458.Test458Kt", methodName = "main", fileName = "test458.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at Test459Kt.main(test459.kt:10) test + +User code: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test459.Test459Kt", methodName = "main", fileName = "test459.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test460Kt.main(test460.kt:10) test + +User code: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test460.Test460Kt", methodName = "main", fileName = "test460.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test461Kt.main(test461.kt:10) test + +User code: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test461.Test461Kt", methodName = "main", fileName = "test461.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at Test462Kt.main(test462.kt:10) test + +User code: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test462.Test462Kt", methodName = "main", fileName = "test462.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at Test463Kt.main(test463.kt:10) test + +User code: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test463.Test463Kt", methodName = "main", fileName = "test463.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at Test464Kt.main(test464.kt:10) test + +User code: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test464.Test464Kt", methodName = "main", fileName = "test464.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at Test465Kt.main(test465.kt:10) test + +User code: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test465.Test465Kt", methodName = "main", fileName = "test465.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at Test466Kt.main(test466.kt:10) test + +User code: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test466.Test466Kt", methodName = "main", fileName = "test466.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at Test467Kt.main(test467.kt:10) test + +User code: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test467.Test467Kt", methodName = "main", fileName = "test467.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at Test468Kt.main(test468.kt:10) test + +User code: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test468.Test468Kt", methodName = "main", fileName = "test468.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at Test469Kt.main(test469.kt:10) test + +User code: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test469.Test469Kt", methodName = "main", fileName = "test469.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at Test470Kt.main(test470.kt:10) test + +User code: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test470.Test470Kt", methodName = "main", fileName = "test470.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test471Kt.main(test471.kt:10) test + +User code: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test471.Test471Kt", methodName = "main", fileName = "test471.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at Test472Kt.main(test472.kt:10) test + +User code: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test472.Test472Kt", methodName = "main", fileName = "test472.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at Test473Kt.main(test473.kt:10) test + +User code: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test473.Test473Kt", methodName = "main", fileName = "test473.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test474Kt.main(test474.kt:10) test + +User code: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test474.Test474Kt", methodName = "main", fileName = "test474.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at Test475Kt.main(test475.kt:10) test + +User code: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test475.Test475Kt", methodName = "main", fileName = "test475.kt", lineNumber = 10) +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test476Kt.main(test476.kt:10) test + +User code: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test476.Test476Kt", methodName = "main", fileName = "test476.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test477Kt.main(test477.kt:10) test + +User code: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test477.Test477Kt", methodName = "main", fileName = "test477.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### info("info message {}", throwable) at Test481Kt.main(test481.kt:10) test + +User code: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test481.Test481Kt", methodName = "main", fileName = "test481.kt", lineNumber = 10) +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at Test482Kt.main(test482.kt:10) test + +User code: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test482.Test482Kt", methodName = "main", fileName = "test482.kt", lineNumber = 10) +} +``` + +### info(throwable) { "info messageBuilder $i" } at Test483Kt.main(test483.kt:10) test + +User code: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test483.Test483Kt", methodName = "main", fileName = "test483.kt", lineNumber = 10) +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at Test484Kt.main(test484.kt:10) test + +User code: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test484.Test484Kt", methodName = "main", fileName = "test484.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at Test485Kt.main(test485.kt:10) test + +User code: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test485.Test485Kt", methodName = "main", fileName = "test485.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at Test486Kt.main(test486.kt:10) test + +User code: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test486.Test486Kt", methodName = "main", fileName = "test486.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test487Kt.main(test487.kt:10) test + +User code: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test487.Test487Kt", methodName = "main", fileName = "test487.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at Test488Kt.main(test488.kt:10) test + +User code: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test488.Test488Kt", methodName = "main", fileName = "test488.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at Test489Kt.main(test489.kt:10) test + +User code: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test489.Test489Kt", methodName = "main", fileName = "test489.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test490Kt.main(test490.kt:10) test + +User code: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test490.Test490Kt", methodName = "main", fileName = "test490.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at Test491Kt.main(test491.kt:10) test + +User code: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test491.Test491Kt", methodName = "main", fileName = "test491.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test492Kt.main(test492.kt:10) test + +User code: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test492.Test492Kt", methodName = "main", fileName = "test492.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test493Kt.main(test493.kt:10) test + +User code: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test493.Test493Kt", methodName = "main", fileName = "test493.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at Test494Kt.main(test494.kt:10) test + +User code: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test494.Test494Kt", methodName = "main", fileName = "test494.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at Test495Kt.main(test495.kt:10) test + +User code: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test495.Test495Kt", methodName = "main", fileName = "test495.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at Test496Kt.main(test496.kt:10) test + +User code: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test496.Test496Kt", methodName = "main", fileName = "test496.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at Test497Kt.main(test497.kt:10) test + +User code: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test497.Test497Kt", methodName = "main", fileName = "test497.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at Test501Kt.main(test501.kt:10) test + +User code: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test501.Test501Kt", methodName = "main", fileName = "test501.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at Test502Kt.main(test502.kt:10) test + +User code: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test502.Test502Kt", methodName = "main", fileName = "test502.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test503Kt.main(test503.kt:10) test + +User code: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test503.Test503Kt", methodName = "main", fileName = "test503.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at Test504Kt.main(test504.kt:10) test + +User code: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test504.Test504Kt", methodName = "main", fileName = "test504.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at Test505Kt.main(test505.kt:10) test + +User code: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test505.Test505Kt", methodName = "main", fileName = "test505.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test506Kt.main(test506.kt:10) test + +User code: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test506.Test506Kt", methodName = "main", fileName = "test506.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at Test507Kt.main(test507.kt:10) test + +User code: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) +} +``` + +Transformed into: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test507.Test507Kt", methodName = "main", fileName = "test507.kt", lineNumber = 10) +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test508Kt.main(test508.kt:10) test + +User code: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test508.Test508Kt", methodName = "main", fileName = "test508.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test509Kt.main(test509.kt:10) test + +User code: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test509.Test509Kt", methodName = "main", fileName = "test509.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### info("info message {}") at Test513Kt.main(test513.kt:10) test + +User code: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") +} +``` + +Transformed into: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test513.Test513Kt", methodName = "main", fileName = "test513.kt", lineNumber = 10) +} +``` + +
+ +### info() { "info messageBuilder" } at Test514Kt.main(test514.kt:10) test + +User code: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test514.Test514Kt", methodName = "main", fileName = "test514.kt", lineNumber = 10) +} +``` + +### info() { "info messageBuilder $i" } at Test515Kt.main(test515.kt:10) test + +User code: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test515.Test515Kt", methodName = "main", fileName = "test515.kt", lineNumber = 10) +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at Test516Kt.main(test516.kt:10) test + +User code: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test516.Test516Kt", methodName = "main", fileName = "test516.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=null } at Test517Kt.main(test517.kt:10) test + +User code: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test517.Test517Kt", methodName = "main", fileName = "test517.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at Test518Kt.main(test518.kt:10) test + +User code: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test518.Test518Kt", methodName = "main", fileName = "test518.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at Test519Kt.main(test519.kt:10) test + +User code: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test519.Test519Kt", methodName = "main", fileName = "test519.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at Test520Kt.main(test520.kt:10) test + +User code: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test520.Test520Kt", methodName = "main", fileName = "test520.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at Test521Kt.main(test521.kt:10) test + +User code: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test521.Test521Kt", methodName = "main", fileName = "test521.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at Test522Kt.main(test522.kt:10) test + +User code: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test522.Test522Kt", methodName = "main", fileName = "test522.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at Test523Kt.main(test523.kt:10) test + +User code: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test523.Test523Kt", methodName = "main", fileName = "test523.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test524Kt.main(test524.kt:10) test + +User code: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test524.Test524Kt", methodName = "main", fileName = "test524.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test525Kt.main(test525.kt:10) test + +User code: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test525.Test525Kt", methodName = "main", fileName = "test525.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at Test526Kt.main(test526.kt:10) test + +User code: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test526.Test526Kt", methodName = "main", fileName = "test526.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at Test527Kt.main(test527.kt:10) test + +User code: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test527.Test527Kt", methodName = "main", fileName = "test527.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at Test528Kt.main(test528.kt:10) test + +User code: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test528.Test528Kt", methodName = "main", fileName = "test528.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at Test529Kt.main(test529.kt:10) test + +User code: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test529.Test529Kt", methodName = "main", fileName = "test529.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at Test530Kt.main(test530.kt:10) test + +User code: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test530.Test530Kt", methodName = "main", fileName = "test530.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at Test531Kt.main(test531.kt:10) test + +User code: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test531.Test531Kt", methodName = "main", fileName = "test531.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at Test532Kt.main(test532.kt:10) test + +User code: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test532.Test532Kt", methodName = "main", fileName = "test532.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at Test533Kt.main(test533.kt:10) test + +User code: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test533.Test533Kt", methodName = "main", fileName = "test533.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at Test534Kt.main(test534.kt:10) test + +User code: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test534.Test534Kt", methodName = "main", fileName = "test534.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test535Kt.main(test535.kt:10) test + +User code: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test535.Test535Kt", methodName = "main", fileName = "test535.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at Test536Kt.main(test536.kt:10) test + +User code: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test536.Test536Kt", methodName = "main", fileName = "test536.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at Test537Kt.main(test537.kt:10) test + +User code: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test537.Test537Kt", methodName = "main", fileName = "test537.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test538Kt.main(test538.kt:10) test + +User code: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test538.Test538Kt", methodName = "main", fileName = "test538.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at Test539Kt.main(test539.kt:10) test + +User code: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test539.Test539Kt", methodName = "main", fileName = "test539.kt", lineNumber = 10) +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test540Kt.main(test540.kt:10) test + +User code: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test540.Test540Kt", methodName = "main", fileName = "test540.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test541Kt.main(test541.kt:10) test + +User code: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test541.Test541Kt", methodName = "main", fileName = "test541.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}", throwable) at Test545Kt.main(test545.kt:10) test + +User code: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test545.Test545Kt", methodName = "main", fileName = "test545.kt", lineNumber = 10) +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at Test546Kt.main(test546.kt:10) test + +User code: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test546.Test546Kt", methodName = "main", fileName = "test546.kt", lineNumber = 10) +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at Test547Kt.main(test547.kt:10) test + +User code: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test547.Test547Kt", methodName = "main", fileName = "test547.kt", lineNumber = 10) +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at Test548Kt.main(test548.kt:10) test + +User code: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test548.Test548Kt", methodName = "main", fileName = "test548.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at Test549Kt.main(test549.kt:10) test + +User code: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test549.Test549Kt", methodName = "main", fileName = "test549.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at Test550Kt.main(test550.kt:10) test + +User code: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test550.Test550Kt", methodName = "main", fileName = "test550.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test551Kt.main(test551.kt:10) test + +User code: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test551.Test551Kt", methodName = "main", fileName = "test551.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at Test552Kt.main(test552.kt:10) test + +User code: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test552.Test552Kt", methodName = "main", fileName = "test552.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at Test553Kt.main(test553.kt:10) test + +User code: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test553.Test553Kt", methodName = "main", fileName = "test553.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test554Kt.main(test554.kt:10) test + +User code: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test554.Test554Kt", methodName = "main", fileName = "test554.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at Test555Kt.main(test555.kt:10) test + +User code: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test555.Test555Kt", methodName = "main", fileName = "test555.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test556Kt.main(test556.kt:10) test + +User code: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test556.Test556Kt", methodName = "main", fileName = "test556.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test557Kt.main(test557.kt:10) test + +User code: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test557.Test557Kt", methodName = "main", fileName = "test557.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at Test558Kt.main(test558.kt:10) test + +User code: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test558.Test558Kt", methodName = "main", fileName = "test558.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at Test559Kt.main(test559.kt:10) test + +User code: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test559.Test559Kt", methodName = "main", fileName = "test559.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at Test560Kt.main(test560.kt:10) test + +User code: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test560.Test560Kt", methodName = "main", fileName = "test560.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at Test561Kt.main(test561.kt:10) test + +User code: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test561.Test561Kt", methodName = "main", fileName = "test561.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at Test565Kt.main(test565.kt:10) test + +User code: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test565.Test565Kt", methodName = "main", fileName = "test565.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at Test566Kt.main(test566.kt:10) test + +User code: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test566.Test566Kt", methodName = "main", fileName = "test566.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test567Kt.main(test567.kt:10) test + +User code: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test567.Test567Kt", methodName = "main", fileName = "test567.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at Test568Kt.main(test568.kt:10) test + +User code: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test568.Test568Kt", methodName = "main", fileName = "test568.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at Test569Kt.main(test569.kt:10) test + +User code: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test569.Test569Kt", methodName = "main", fileName = "test569.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test570Kt.main(test570.kt:10) test + +User code: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test570.Test570Kt", methodName = "main", fileName = "test570.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at Test571Kt.main(test571.kt:10) test + +User code: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) +} +``` + +Transformed into: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test571.Test571Kt", methodName = "main", fileName = "test571.kt", lineNumber = 10) +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test572Kt.main(test572.kt:10) test + +User code: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test572.Test572Kt", methodName = "main", fileName = "test572.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test573Kt.main(test573.kt:10) test + +User code: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test573.Test573Kt", methodName = "main", fileName = "test573.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}") at Test577Kt.main(test577.kt:10) test + +User code: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") +} +``` + +Transformed into: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test577.Test577Kt", methodName = "main", fileName = "test577.kt", lineNumber = 10) +} +``` + +
+ +### warn() { "warn messageBuilder" } at Test578Kt.main(test578.kt:10) test + +User code: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test578.Test578Kt", methodName = "main", fileName = "test578.kt", lineNumber = 10) +} +``` + +### warn() { "warn messageBuilder $i" } at Test579Kt.main(test579.kt:10) test + +User code: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test579.Test579Kt", methodName = "main", fileName = "test579.kt", lineNumber = 10) +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at Test580Kt.main(test580.kt:10) test + +User code: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test580.Test580Kt", methodName = "main", fileName = "test580.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at Test581Kt.main(test581.kt:10) test + +User code: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test581.Test581Kt", methodName = "main", fileName = "test581.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at Test582Kt.main(test582.kt:10) test + +User code: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test582.Test582Kt", methodName = "main", fileName = "test582.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at Test583Kt.main(test583.kt:10) test + +User code: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test583.Test583Kt", methodName = "main", fileName = "test583.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at Test584Kt.main(test584.kt:10) test + +User code: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test584.Test584Kt", methodName = "main", fileName = "test584.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at Test585Kt.main(test585.kt:10) test + +User code: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test585.Test585Kt", methodName = "main", fileName = "test585.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test586Kt.main(test586.kt:10) test + +User code: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test586.Test586Kt", methodName = "main", fileName = "test586.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at Test587Kt.main(test587.kt:10) test + +User code: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test587.Test587Kt", methodName = "main", fileName = "test587.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test588Kt.main(test588.kt:10) test + +User code: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test588.Test588Kt", methodName = "main", fileName = "test588.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test589Kt.main(test589.kt:10) test + +User code: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test589.Test589Kt", methodName = "main", fileName = "test589.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at Test590Kt.main(test590.kt:10) test + +User code: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test590.Test590Kt", methodName = "main", fileName = "test590.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at Test591Kt.main(test591.kt:10) test + +User code: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test591.Test591Kt", methodName = "main", fileName = "test591.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at Test592Kt.main(test592.kt:10) test + +User code: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test592.Test592Kt", methodName = "main", fileName = "test592.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at Test593Kt.main(test593.kt:10) test + +User code: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test593.Test593Kt", methodName = "main", fileName = "test593.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at Test594Kt.main(test594.kt:10) test + +User code: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test594.Test594Kt", methodName = "main", fileName = "test594.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at Test595Kt.main(test595.kt:10) test + +User code: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test595.Test595Kt", methodName = "main", fileName = "test595.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at Test596Kt.main(test596.kt:10) test + +User code: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test596.Test596Kt", methodName = "main", fileName = "test596.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at Test597Kt.main(test597.kt:10) test + +User code: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test597.Test597Kt", methodName = "main", fileName = "test597.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at Test598Kt.main(test598.kt:10) test + +User code: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test598.Test598Kt", methodName = "main", fileName = "test598.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test599Kt.main(test599.kt:10) test + +User code: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test599.Test599Kt", methodName = "main", fileName = "test599.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at Test600Kt.main(test600.kt:10) test + +User code: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test600.Test600Kt", methodName = "main", fileName = "test600.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at Test601Kt.main(test601.kt:10) test + +User code: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test601.Test601Kt", methodName = "main", fileName = "test601.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test602Kt.main(test602.kt:10) test + +User code: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test602.Test602Kt", methodName = "main", fileName = "test602.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at Test603Kt.main(test603.kt:10) test + +User code: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test603.Test603Kt", methodName = "main", fileName = "test603.kt", lineNumber = 10) +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test604Kt.main(test604.kt:10) test + +User code: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test604.Test604Kt", methodName = "main", fileName = "test604.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test605Kt.main(test605.kt:10) test + +User code: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test605.Test605Kt", methodName = "main", fileName = "test605.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### error("error message {}", throwable) at Test609Kt.main(test609.kt:10) test + +User code: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test609.Test609Kt", methodName = "main", fileName = "test609.kt", lineNumber = 10) +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at Test610Kt.main(test610.kt:10) test + +User code: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test610.Test610Kt", methodName = "main", fileName = "test610.kt", lineNumber = 10) +} +``` + +### error(throwable) { "error messageBuilder $i" } at Test611Kt.main(test611.kt:10) test + +User code: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test611.Test611Kt", methodName = "main", fileName = "test611.kt", lineNumber = 10) +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at Test612Kt.main(test612.kt:10) test + +User code: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test612.Test612Kt", methodName = "main", fileName = "test612.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=throwable } at Test613Kt.main(test613.kt:10) test + +User code: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test613.Test613Kt", methodName = "main", fileName = "test613.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at Test614Kt.main(test614.kt:10) test + +User code: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test614.Test614Kt", methodName = "main", fileName = "test614.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test615Kt.main(test615.kt:10) test + +User code: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test615.Test615Kt", methodName = "main", fileName = "test615.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at Test616Kt.main(test616.kt:10) test + +User code: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test616.Test616Kt", methodName = "main", fileName = "test616.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at Test617Kt.main(test617.kt:10) test + +User code: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test617.Test617Kt", methodName = "main", fileName = "test617.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test618Kt.main(test618.kt:10) test + +User code: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test618.Test618Kt", methodName = "main", fileName = "test618.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at Test619Kt.main(test619.kt:10) test + +User code: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test619.Test619Kt", methodName = "main", fileName = "test619.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test620Kt.main(test620.kt:10) test + +User code: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test620.Test620Kt", methodName = "main", fileName = "test620.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test621Kt.main(test621.kt:10) test + +User code: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test621.Test621Kt", methodName = "main", fileName = "test621.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at Test622Kt.main(test622.kt:10) test + +User code: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test622.Test622Kt", methodName = "main", fileName = "test622.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at Test623Kt.main(test623.kt:10) test + +User code: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test623.Test623Kt", methodName = "main", fileName = "test623.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at Test624Kt.main(test624.kt:10) test + +User code: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test624.Test624Kt", methodName = "main", fileName = "test624.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at Test625Kt.main(test625.kt:10) test + +User code: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test625.Test625Kt", methodName = "main", fileName = "test625.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at Test629Kt.main(test629.kt:10) test + +User code: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test629.Test629Kt", methodName = "main", fileName = "test629.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at Test630Kt.main(test630.kt:10) test + +User code: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test630.Test630Kt", methodName = "main", fileName = "test630.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test631Kt.main(test631.kt:10) test + +User code: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test631.Test631Kt", methodName = "main", fileName = "test631.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at Test632Kt.main(test632.kt:10) test + +User code: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test632.Test632Kt", methodName = "main", fileName = "test632.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at Test633Kt.main(test633.kt:10) test + +User code: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test633.Test633Kt", methodName = "main", fileName = "test633.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test634Kt.main(test634.kt:10) test + +User code: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test634.Test634Kt", methodName = "main", fileName = "test634.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at Test635Kt.main(test635.kt:10) test + +User code: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) +} +``` + +Transformed into: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test635.Test635Kt", methodName = "main", fileName = "test635.kt", lineNumber = 10) +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test636Kt.main(test636.kt:10) test + +User code: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test636.Test636Kt", methodName = "main", fileName = "test636.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test637Kt.main(test637.kt:10) test + +User code: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test637.Test637Kt", methodName = "main", fileName = "test637.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### error("error message {}") at Test641Kt.main(test641.kt:10) test + +User code: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") +} +``` + +Transformed into: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test641.Test641Kt", methodName = "main", fileName = "test641.kt", lineNumber = 10) +} +``` + +
+ +### error() { "error messageBuilder" } at Test642Kt.main(test642.kt:10) test + +User code: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test642.Test642Kt", methodName = "main", fileName = "test642.kt", lineNumber = 10) +} +``` + +### error() { "error messageBuilder $i" } at Test643Kt.main(test643.kt:10) test + +User code: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test643.Test643Kt", methodName = "main", fileName = "test643.kt", lineNumber = 10) +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at Test644Kt.main(test644.kt:10) test + +User code: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test644.Test644Kt", methodName = "main", fileName = "test644.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=null } at Test645Kt.main(test645.kt:10) test + +User code: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test645.Test645Kt", methodName = "main", fileName = "test645.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at Test646Kt.main(test646.kt:10) test + +User code: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test646.Test646Kt", methodName = "main", fileName = "test646.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at Test647Kt.main(test647.kt:10) test + +User code: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test647.Test647Kt", methodName = "main", fileName = "test647.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at Test648Kt.main(test648.kt:10) test + +User code: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test648.Test648Kt", methodName = "main", fileName = "test648.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at Test649Kt.main(test649.kt:10) test + +User code: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test649.Test649Kt", methodName = "main", fileName = "test649.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at Test650Kt.main(test650.kt:10) test + +User code: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test650.Test650Kt", methodName = "main", fileName = "test650.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
+ +
featureFlag=DISABLE_ALL + +
with class=true + +
entry/exit API + +### entry(argument1, argument2) at MainTest.main(test1.kt:10) test + +User code: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) + } + +} +``` + +Remains as-is: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) + } + +} +``` + +### exit(resultValue) at MainTest.main(test2.kt:10) test + +User code: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) + } + +} +``` + +Remains as-is: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) + } + +} +``` + +### exit() at MainTest.main(test3.kt:10) test + +User code: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() + } + +} +``` + +Remains as-is: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() + } + +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at MainTest.main(test4.kt:10) test + +User code: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) + } + +} +``` + +### catching(throwable) at MainTest.main(test5.kt:10) test + +User code: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) + } + +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at MainTest.main(test6.kt:10) test + +User code: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test7.kt:10) test + +User code: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test8.kt:10) test + +User code: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at MainTest.main(test9.kt:10) test + +User code: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at MainTest.main(test10.kt:10) test + +User code: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test11.kt:10) test + +User code: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at MainTest.main(test12.kt:10) test + +User code: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at MainTest.main(test13.kt:10) test + +User code: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at MainTest.main(test14.kt:10) test + +User code: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test15.kt:10) test + +User code: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test16.kt:10) test + +User code: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test17.kt:10) test + +User code: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test18.kt:10) test + +User code: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test19.kt:10) test + +User code: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test20.kt:10) test + +User code: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test21.kt:10) test + +User code: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at MainTest.main(test22.kt:10) test + +User code: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test23.kt:10) test + +User code: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test24.kt:10) test + +User code: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}", throwable) at MainTest.main(test28.kt:10) test + +User code: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) + } + +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at MainTest.main(test29.kt:10) test + +User code: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } + } + +} +``` + +Remains as-is: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at MainTest.main(test30.kt:10) test + +User code: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } + } + +} +``` + +Remains as-is: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test31.kt:10) test + +User code: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at MainTest.main(test32.kt:10) test + +User code: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test33.kt:10) test + +User code: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test34.kt:10) test + +User code: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test35.kt:10) test + +User code: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test36.kt:10) test + +User code: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test37.kt:10) test + +User code: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at MainTest.main(test38.kt:10) test + +User code: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test39.kt:10) test + +User code: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test40.kt:10) test + +User code: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at MainTest.main(test41.kt:10) test + +User code: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at MainTest.main(test42.kt:10) test + +User code: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test43.kt:10) test + +User code: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at MainTest.main(test44.kt:10) test + +User code: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test48.kt:10) test + +User code: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test49.kt:10) test + +User code: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test50.kt:10) test + +User code: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test51.kt:10) test + +User code: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test52.kt:10) test + +User code: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test53.kt:10) test + +User code: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at MainTest.main(test54.kt:10) test + +User code: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test55.kt:10) test + +User code: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test56.kt:10) test + +User code: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}") at MainTest.main(test60.kt:10) test + +User code: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") + } + +} +``` + +Remains as-is: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") + } + +} +``` + +
+ +### trace() { "trace messageBuilder" } at MainTest.main(test61.kt:10) test + +User code: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } + } + +} +``` + +Remains as-is: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } + } + +} +``` + +### trace() { "trace messageBuilder $i" } at MainTest.main(test62.kt:10) test + +User code: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } + } + +} +``` + +Remains as-is: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } + } + +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at MainTest.main(test63.kt:10) test + +User code: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at MainTest.main(test64.kt:10) test + +User code: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at MainTest.main(test65.kt:10) test + +User code: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test66.kt:10) test + +User code: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at MainTest.main(test67.kt:10) test + +User code: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test68.kt:10) test + +User code: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test69.kt:10) test + +User code: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at MainTest.main(test70.kt:10) test + +User code: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test71.kt:10) test + +User code: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test72.kt:10) test + +User code: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at MainTest.main(test73.kt:10) test + +User code: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at MainTest.main(test74.kt:10) test + +User code: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test75.kt:10) test + +User code: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at MainTest.main(test76.kt:10) test + +User code: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at MainTest.main(test77.kt:10) test + +User code: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at MainTest.main(test78.kt:10) test + +User code: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test79.kt:10) test + +User code: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test80.kt:10) test + +User code: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test81.kt:10) test + +User code: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test82.kt:10) test + +User code: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test83.kt:10) test + +User code: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test84.kt:10) test + +User code: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test85.kt:10) test + +User code: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at MainTest.main(test86.kt:10) test + +User code: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test87.kt:10) test + +User code: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test88.kt:10) test + +User code: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}", throwable) at MainTest.main(test92.kt:10) test + +User code: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) + } + +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at MainTest.main(test93.kt:10) test + +User code: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } + } + +} +``` + +Remains as-is: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at MainTest.main(test94.kt:10) test + +User code: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } + } + +} +``` + +Remains as-is: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test95.kt:10) test + +User code: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at MainTest.main(test96.kt:10) test + +User code: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test97.kt:10) test + +User code: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test98.kt:10) test + +User code: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test99.kt:10) test + +User code: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test100.kt:10) test + +User code: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test101.kt:10) test + +User code: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at MainTest.main(test102.kt:10) test + +User code: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test103.kt:10) test + +User code: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test104.kt:10) test + +User code: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at MainTest.main(test105.kt:10) test + +User code: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at MainTest.main(test106.kt:10) test + +User code: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test107.kt:10) test + +User code: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at MainTest.main(test108.kt:10) test + +User code: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test112.kt:10) test + +User code: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test113.kt:10) test + +User code: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test114.kt:10) test + +User code: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test115.kt:10) test + +User code: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test116.kt:10) test + +User code: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test117.kt:10) test + +User code: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at MainTest.main(test118.kt:10) test + +User code: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test119.kt:10) test + +User code: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test120.kt:10) test + +User code: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}") at MainTest.main(test124.kt:10) test + +User code: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") + } + +} +``` + +Remains as-is: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") + } + +} +``` + +
+ +### debug() { "debug messageBuilder" } at MainTest.main(test125.kt:10) test + +User code: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } + } + +} +``` + +Remains as-is: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } + } + +} +``` + +### debug() { "debug messageBuilder $i" } at MainTest.main(test126.kt:10) test + +User code: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } + } + +} +``` + +Remains as-is: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } + } + +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at MainTest.main(test127.kt:10) test + +User code: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at MainTest.main(test128.kt:10) test + +User code: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at MainTest.main(test129.kt:10) test + +User code: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test130.kt:10) test + +User code: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at MainTest.main(test131.kt:10) test + +User code: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test132.kt:10) test + +User code: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test133.kt:10) test + +User code: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at MainTest.main(test134.kt:10) test + +User code: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test135.kt:10) test + +User code: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test136.kt:10) test + +User code: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at MainTest.main(test137.kt:10) test + +User code: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at MainTest.main(test138.kt:10) test + +User code: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test139.kt:10) test + +User code: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at MainTest.main(test140.kt:10) test + +User code: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at MainTest.main(test141.kt:10) test + +User code: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at MainTest.main(test142.kt:10) test + +User code: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test143.kt:10) test + +User code: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test144.kt:10) test + +User code: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test145.kt:10) test + +User code: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test146.kt:10) test + +User code: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test147.kt:10) test + +User code: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test148.kt:10) test + +User code: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test149.kt:10) test + +User code: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at MainTest.main(test150.kt:10) test + +User code: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test151.kt:10) test + +User code: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test152.kt:10) test + +User code: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}", throwable) at MainTest.main(test156.kt:10) test + +User code: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) + } + +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at MainTest.main(test157.kt:10) test + +User code: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } + } + +} +``` + +Remains as-is: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } + } + +} +``` + +### info(throwable) { "info messageBuilder $i" } at MainTest.main(test158.kt:10) test + +User code: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } + } + +} +``` + +Remains as-is: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } + } + +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test159.kt:10) test + +User code: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at MainTest.main(test160.kt:10) test + +User code: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test161.kt:10) test + +User code: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test162.kt:10) test + +User code: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at MainTest.main(test163.kt:10) test + +User code: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test164.kt:10) test + +User code: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test165.kt:10) test + +User code: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at MainTest.main(test166.kt:10) test + +User code: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test167.kt:10) test + +User code: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test168.kt:10) test + +User code: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at MainTest.main(test169.kt:10) test + +User code: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at MainTest.main(test170.kt:10) test + +User code: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test171.kt:10) test + +User code: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at MainTest.main(test172.kt:10) test + +User code: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at MainTest.main(test176.kt:10) test + +User code: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test177.kt:10) test + +User code: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test178.kt:10) test + +User code: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at MainTest.main(test179.kt:10) test + +User code: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test180.kt:10) test + +User code: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test181.kt:10) test + +User code: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at MainTest.main(test182.kt:10) test + +User code: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test183.kt:10) test + +User code: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test184.kt:10) test + +User code: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}") at MainTest.main(test188.kt:10) test + +User code: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") + } + +} +``` + +Remains as-is: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") + } + +} +``` + +
+ +### info() { "info messageBuilder" } at MainTest.main(test189.kt:10) test + +User code: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } + } + +} +``` + +Remains as-is: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } + } + +} +``` + +### info() { "info messageBuilder $i" } at MainTest.main(test190.kt:10) test + +User code: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } + } + +} +``` + +Remains as-is: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } + } + +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at MainTest.main(test191.kt:10) test + +User code: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=null } at MainTest.main(test192.kt:10) test + +User code: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at MainTest.main(test193.kt:10) test + +User code: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test194.kt:10) test + +User code: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at MainTest.main(test195.kt:10) test + +User code: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at MainTest.main(test196.kt:10) test + +User code: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test197.kt:10) test + +User code: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at MainTest.main(test198.kt:10) test + +User code: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test199.kt:10) test + +User code: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test200.kt:10) test + +User code: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at MainTest.main(test201.kt:10) test + +User code: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at MainTest.main(test202.kt:10) test + +User code: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test203.kt:10) test + +User code: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at MainTest.main(test204.kt:10) test + +User code: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at MainTest.main(test205.kt:10) test + +User code: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at MainTest.main(test206.kt:10) test + +User code: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test207.kt:10) test + +User code: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test208.kt:10) test + +User code: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test209.kt:10) test + +User code: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test210.kt:10) test + +User code: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test211.kt:10) test + +User code: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test212.kt:10) test + +User code: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test213.kt:10) test + +User code: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at MainTest.main(test214.kt:10) test + +User code: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test215.kt:10) test + +User code: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test216.kt:10) test + +User code: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}", throwable) at MainTest.main(test220.kt:10) test + +User code: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) + } + +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at MainTest.main(test221.kt:10) test + +User code: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } + } + +} +``` + +Remains as-is: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at MainTest.main(test222.kt:10) test + +User code: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } + } + +} +``` + +Remains as-is: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test223.kt:10) test + +User code: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at MainTest.main(test224.kt:10) test + +User code: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test225.kt:10) test + +User code: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test226.kt:10) test + +User code: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test227.kt:10) test + +User code: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test228.kt:10) test + +User code: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test229.kt:10) test + +User code: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at MainTest.main(test230.kt:10) test + +User code: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test231.kt:10) test + +User code: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test232.kt:10) test + +User code: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at MainTest.main(test233.kt:10) test + +User code: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at MainTest.main(test234.kt:10) test + +User code: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test235.kt:10) test + +User code: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at MainTest.main(test236.kt:10) test + +User code: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test240.kt:10) test + +User code: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test241.kt:10) test + +User code: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test242.kt:10) test + +User code: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test243.kt:10) test + +User code: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test244.kt:10) test + +User code: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test245.kt:10) test + +User code: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at MainTest.main(test246.kt:10) test + +User code: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test247.kt:10) test + +User code: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test248.kt:10) test + +User code: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}") at MainTest.main(test252.kt:10) test + +User code: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") + } + +} +``` + +Remains as-is: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") + } + +} +``` + +
+ +### warn() { "warn messageBuilder" } at MainTest.main(test253.kt:10) test + +User code: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } + } + +} +``` + +Remains as-is: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } + } + +} +``` + +### warn() { "warn messageBuilder $i" } at MainTest.main(test254.kt:10) test + +User code: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } + } + +} +``` + +Remains as-is: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } + } + +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at MainTest.main(test255.kt:10) test + +User code: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at MainTest.main(test256.kt:10) test + +User code: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at MainTest.main(test257.kt:10) test + +User code: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test258.kt:10) test + +User code: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at MainTest.main(test259.kt:10) test + +User code: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test260.kt:10) test + +User code: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test261.kt:10) test + +User code: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at MainTest.main(test262.kt:10) test + +User code: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test263.kt:10) test + +User code: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test264.kt:10) test + +User code: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at MainTest.main(test265.kt:10) test + +User code: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at MainTest.main(test266.kt:10) test + +User code: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test267.kt:10) test + +User code: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at MainTest.main(test268.kt:10) test + +User code: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at MainTest.main(test269.kt:10) test + +User code: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at MainTest.main(test270.kt:10) test + +User code: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test271.kt:10) test + +User code: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test272.kt:10) test + +User code: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test273.kt:10) test + +User code: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test274.kt:10) test + +User code: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test275.kt:10) test + +User code: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test276.kt:10) test + +User code: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test277.kt:10) test + +User code: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at MainTest.main(test278.kt:10) test + +User code: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test279.kt:10) test + +User code: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test280.kt:10) test + +User code: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}", throwable) at MainTest.main(test284.kt:10) test + +User code: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) + } + +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at MainTest.main(test285.kt:10) test + +User code: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } + } + +} +``` + +Remains as-is: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } + } + +} +``` + +### error(throwable) { "error messageBuilder $i" } at MainTest.main(test286.kt:10) test + +User code: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } + } + +} +``` + +Remains as-is: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } + } + +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test287.kt:10) test + +User code: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=throwable } at MainTest.main(test288.kt:10) test + +User code: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test289.kt:10) test + +User code: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test290.kt:10) test + +User code: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at MainTest.main(test291.kt:10) test + +User code: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test292.kt:10) test + +User code: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test293.kt:10) test + +User code: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at MainTest.main(test294.kt:10) test + +User code: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test295.kt:10) test + +User code: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test296.kt:10) test + +User code: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at MainTest.main(test297.kt:10) test + +User code: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at MainTest.main(test298.kt:10) test + +User code: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test299.kt:10) test + +User code: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at MainTest.main(test300.kt:10) test + +User code: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at MainTest.main(test304.kt:10) test + +User code: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test305.kt:10) test + +User code: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test306.kt:10) test + +User code: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at MainTest.main(test307.kt:10) test + +User code: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test308.kt:10) test + +User code: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test309.kt:10) test + +User code: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at MainTest.main(test310.kt:10) test + +User code: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test311.kt:10) test + +User code: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test312.kt:10) test + +User code: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}") at MainTest.main(test316.kt:10) test + +User code: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") + } + +} +``` + +Remains as-is: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") + } + +} +``` + +
+ +### error() { "error messageBuilder" } at MainTest.main(test317.kt:10) test + +User code: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } + } + +} +``` + +Remains as-is: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } + } + +} +``` + +### error() { "error messageBuilder $i" } at MainTest.main(test318.kt:10) test + +User code: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } + } + +} +``` + +Remains as-is: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } + } + +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at MainTest.main(test319.kt:10) test + +User code: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=null } at MainTest.main(test320.kt:10) test + +User code: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at MainTest.main(test321.kt:10) test + +User code: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test322.kt:10) test + +User code: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at MainTest.main(test323.kt:10) test + +User code: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at MainTest.main(test324.kt:10) test + +User code: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test325.kt:10) test + +User code: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
+ +
with class=false + +
entry/exit API + +### entry(argument1, argument2) at Test326Kt.main(test326.kt:10) test + +User code: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) +} +``` + +Remains as-is: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) +} +``` + +### exit(resultValue) at Test327Kt.main(test327.kt:10) test + +User code: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) +} +``` + +Remains as-is: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) +} +``` + +### exit() at Test328Kt.main(test328.kt:10) test + +User code: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() +} +``` + +Remains as-is: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at Test329Kt.main(test329.kt:10) test + +User code: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) +} +``` + +Remains as-is: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) +} +``` + +### catching(throwable) at Test330Kt.main(test330.kt:10) test + +User code: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) +} +``` + +Remains as-is: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at Test331Kt.main(test331.kt:10) test + +User code: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test332Kt.main(test332.kt:10) test + +User code: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test333Kt.main(test333.kt:10) test + +User code: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at Test334Kt.main(test334.kt:10) test + +User code: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at Test335Kt.main(test335.kt:10) test + +User code: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at Test336Kt.main(test336.kt:10) test + +User code: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at Test337Kt.main(test337.kt:10) test + +User code: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at Test338Kt.main(test338.kt:10) test + +User code: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at Test339Kt.main(test339.kt:10) test + +User code: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at Test340Kt.main(test340.kt:10) test + +User code: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at Test341Kt.main(test341.kt:10) test + +User code: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at Test342Kt.main(test342.kt:10) test + +User code: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test343Kt.main(test343.kt:10) test + +User code: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at Test344Kt.main(test344.kt:10) test + +User code: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at Test345Kt.main(test345.kt:10) test + +User code: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test346Kt.main(test346.kt:10) test + +User code: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at Test347Kt.main(test347.kt:10) test + +User code: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test348Kt.main(test348.kt:10) test + +User code: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test349Kt.main(test349.kt:10) test + +User code: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}", throwable) at Test353Kt.main(test353.kt:10) test + +User code: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) +} +``` + +Remains as-is: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at Test354Kt.main(test354.kt:10) test + +User code: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } +} +``` + +Remains as-is: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at Test355Kt.main(test355.kt:10) test + +User code: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } +} +``` + +Remains as-is: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at Test356Kt.main(test356.kt:10) test + +User code: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at Test357Kt.main(test357.kt:10) test + +User code: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at Test358Kt.main(test358.kt:10) test + +User code: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test359Kt.main(test359.kt:10) test + +User code: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at Test360Kt.main(test360.kt:10) test + +User code: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at Test361Kt.main(test361.kt:10) test + +User code: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test362Kt.main(test362.kt:10) test + +User code: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at Test363Kt.main(test363.kt:10) test + +User code: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test364Kt.main(test364.kt:10) test + +User code: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test365Kt.main(test365.kt:10) test + +User code: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at Test366Kt.main(test366.kt:10) test + +User code: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at Test367Kt.main(test367.kt:10) test + +User code: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at Test368Kt.main(test368.kt:10) test + +User code: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at Test369Kt.main(test369.kt:10) test + +User code: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at Test373Kt.main(test373.kt:10) test + +User code: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at Test374Kt.main(test374.kt:10) test + +User code: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test375Kt.main(test375.kt:10) test + +User code: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at Test376Kt.main(test376.kt:10) test + +User code: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at Test377Kt.main(test377.kt:10) test + +User code: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test378Kt.main(test378.kt:10) test + +User code: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at Test379Kt.main(test379.kt:10) test + +User code: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test380Kt.main(test380.kt:10) test + +User code: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test381Kt.main(test381.kt:10) test + +User code: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}") at Test385Kt.main(test385.kt:10) test + +User code: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") +} +``` + +Remains as-is: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") +} +``` + +
+ +### trace() { "trace messageBuilder" } at Test386Kt.main(test386.kt:10) test + +User code: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } +} +``` + +Remains as-is: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } +} +``` + +### trace() { "trace messageBuilder $i" } at Test387Kt.main(test387.kt:10) test + +User code: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } +} +``` + +Remains as-is: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at Test388Kt.main(test388.kt:10) test + +User code: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at Test389Kt.main(test389.kt:10) test + +User code: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at Test390Kt.main(test390.kt:10) test + +User code: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at Test391Kt.main(test391.kt:10) test + +User code: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at Test392Kt.main(test392.kt:10) test + +User code: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at Test393Kt.main(test393.kt:10) test + +User code: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test394Kt.main(test394.kt:10) test + +User code: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at Test395Kt.main(test395.kt:10) test + +User code: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test396Kt.main(test396.kt:10) test + +User code: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test397Kt.main(test397.kt:10) test + +User code: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at Test398Kt.main(test398.kt:10) test + +User code: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at Test399Kt.main(test399.kt:10) test + +User code: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at Test400Kt.main(test400.kt:10) test + +User code: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at Test401Kt.main(test401.kt:10) test + +User code: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at Test402Kt.main(test402.kt:10) test + +User code: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at Test403Kt.main(test403.kt:10) test + +User code: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at Test404Kt.main(test404.kt:10) test + +User code: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at Test405Kt.main(test405.kt:10) test + +User code: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at Test406Kt.main(test406.kt:10) test + +User code: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test407Kt.main(test407.kt:10) test + +User code: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at Test408Kt.main(test408.kt:10) test + +User code: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at Test409Kt.main(test409.kt:10) test + +User code: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test410Kt.main(test410.kt:10) test + +User code: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at Test411Kt.main(test411.kt:10) test + +User code: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test412Kt.main(test412.kt:10) test + +User code: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test413Kt.main(test413.kt:10) test + +User code: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}", throwable) at Test417Kt.main(test417.kt:10) test + +User code: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) +} +``` + +Remains as-is: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at Test418Kt.main(test418.kt:10) test + +User code: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } +} +``` + +Remains as-is: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at Test419Kt.main(test419.kt:10) test + +User code: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } +} +``` + +Remains as-is: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at Test420Kt.main(test420.kt:10) test + +User code: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at Test421Kt.main(test421.kt:10) test + +User code: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at Test422Kt.main(test422.kt:10) test + +User code: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test423Kt.main(test423.kt:10) test + +User code: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at Test424Kt.main(test424.kt:10) test + +User code: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at Test425Kt.main(test425.kt:10) test + +User code: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test426Kt.main(test426.kt:10) test + +User code: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at Test427Kt.main(test427.kt:10) test + +User code: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test428Kt.main(test428.kt:10) test + +User code: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test429Kt.main(test429.kt:10) test + +User code: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at Test430Kt.main(test430.kt:10) test + +User code: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at Test431Kt.main(test431.kt:10) test + +User code: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at Test432Kt.main(test432.kt:10) test + +User code: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at Test433Kt.main(test433.kt:10) test + +User code: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at Test437Kt.main(test437.kt:10) test + +User code: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at Test438Kt.main(test438.kt:10) test + +User code: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test439Kt.main(test439.kt:10) test + +User code: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at Test440Kt.main(test440.kt:10) test + +User code: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at Test441Kt.main(test441.kt:10) test + +User code: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test442Kt.main(test442.kt:10) test + +User code: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at Test443Kt.main(test443.kt:10) test + +User code: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test444Kt.main(test444.kt:10) test + +User code: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test445Kt.main(test445.kt:10) test + +User code: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}") at Test449Kt.main(test449.kt:10) test + +User code: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") +} +``` + +Remains as-is: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") +} +``` + +
+ +### debug() { "debug messageBuilder" } at Test450Kt.main(test450.kt:10) test + +User code: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } +} +``` + +Remains as-is: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } +} +``` + +### debug() { "debug messageBuilder $i" } at Test451Kt.main(test451.kt:10) test + +User code: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } +} +``` + +Remains as-is: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at Test452Kt.main(test452.kt:10) test + +User code: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at Test453Kt.main(test453.kt:10) test + +User code: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at Test454Kt.main(test454.kt:10) test + +User code: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at Test455Kt.main(test455.kt:10) test + +User code: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at Test456Kt.main(test456.kt:10) test + +User code: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at Test457Kt.main(test457.kt:10) test + +User code: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test458Kt.main(test458.kt:10) test + +User code: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at Test459Kt.main(test459.kt:10) test + +User code: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test460Kt.main(test460.kt:10) test + +User code: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test461Kt.main(test461.kt:10) test + +User code: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at Test462Kt.main(test462.kt:10) test + +User code: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at Test463Kt.main(test463.kt:10) test + +User code: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at Test464Kt.main(test464.kt:10) test + +User code: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at Test465Kt.main(test465.kt:10) test + +User code: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at Test466Kt.main(test466.kt:10) test + +User code: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at Test467Kt.main(test467.kt:10) test + +User code: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at Test468Kt.main(test468.kt:10) test + +User code: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at Test469Kt.main(test469.kt:10) test + +User code: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at Test470Kt.main(test470.kt:10) test + +User code: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test471Kt.main(test471.kt:10) test + +User code: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at Test472Kt.main(test472.kt:10) test + +User code: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at Test473Kt.main(test473.kt:10) test + +User code: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test474Kt.main(test474.kt:10) test + +User code: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at Test475Kt.main(test475.kt:10) test + +User code: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test476Kt.main(test476.kt:10) test + +User code: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test477Kt.main(test477.kt:10) test + +User code: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### info("info message {}", throwable) at Test481Kt.main(test481.kt:10) test + +User code: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) +} +``` + +Remains as-is: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at Test482Kt.main(test482.kt:10) test + +User code: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } +} +``` + +Remains as-is: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } +} +``` + +### info(throwable) { "info messageBuilder $i" } at Test483Kt.main(test483.kt:10) test + +User code: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } +} +``` + +Remains as-is: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at Test484Kt.main(test484.kt:10) test + +User code: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at Test485Kt.main(test485.kt:10) test + +User code: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at Test486Kt.main(test486.kt:10) test + +User code: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test487Kt.main(test487.kt:10) test + +User code: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at Test488Kt.main(test488.kt:10) test + +User code: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at Test489Kt.main(test489.kt:10) test + +User code: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test490Kt.main(test490.kt:10) test + +User code: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at Test491Kt.main(test491.kt:10) test + +User code: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test492Kt.main(test492.kt:10) test + +User code: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test493Kt.main(test493.kt:10) test + +User code: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at Test494Kt.main(test494.kt:10) test + +User code: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at Test495Kt.main(test495.kt:10) test + +User code: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at Test496Kt.main(test496.kt:10) test + +User code: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at Test497Kt.main(test497.kt:10) test + +User code: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at Test501Kt.main(test501.kt:10) test + +User code: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at Test502Kt.main(test502.kt:10) test + +User code: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test503Kt.main(test503.kt:10) test + +User code: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at Test504Kt.main(test504.kt:10) test + +User code: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at Test505Kt.main(test505.kt:10) test + +User code: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test506Kt.main(test506.kt:10) test + +User code: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at Test507Kt.main(test507.kt:10) test + +User code: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test508Kt.main(test508.kt:10) test + +User code: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test509Kt.main(test509.kt:10) test + +User code: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### info("info message {}") at Test513Kt.main(test513.kt:10) test + +User code: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") +} +``` + +Remains as-is: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") +} +``` + +
+ +### info() { "info messageBuilder" } at Test514Kt.main(test514.kt:10) test + +User code: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } +} +``` + +Remains as-is: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } +} +``` + +### info() { "info messageBuilder $i" } at Test515Kt.main(test515.kt:10) test + +User code: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } +} +``` + +Remains as-is: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at Test516Kt.main(test516.kt:10) test + +User code: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=null } at Test517Kt.main(test517.kt:10) test + +User code: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at Test518Kt.main(test518.kt:10) test + +User code: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at Test519Kt.main(test519.kt:10) test + +User code: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at Test520Kt.main(test520.kt:10) test + +User code: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at Test521Kt.main(test521.kt:10) test + +User code: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at Test522Kt.main(test522.kt:10) test + +User code: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at Test523Kt.main(test523.kt:10) test + +User code: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test524Kt.main(test524.kt:10) test + +User code: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test525Kt.main(test525.kt:10) test + +User code: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at Test526Kt.main(test526.kt:10) test + +User code: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at Test527Kt.main(test527.kt:10) test + +User code: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at Test528Kt.main(test528.kt:10) test + +User code: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at Test529Kt.main(test529.kt:10) test + +User code: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at Test530Kt.main(test530.kt:10) test + +User code: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at Test531Kt.main(test531.kt:10) test + +User code: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at Test532Kt.main(test532.kt:10) test + +User code: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at Test533Kt.main(test533.kt:10) test + +User code: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at Test534Kt.main(test534.kt:10) test + +User code: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test535Kt.main(test535.kt:10) test + +User code: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at Test536Kt.main(test536.kt:10) test + +User code: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at Test537Kt.main(test537.kt:10) test + +User code: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test538Kt.main(test538.kt:10) test + +User code: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at Test539Kt.main(test539.kt:10) test + +User code: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test540Kt.main(test540.kt:10) test + +User code: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test541Kt.main(test541.kt:10) test + +User code: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}", throwable) at Test545Kt.main(test545.kt:10) test + +User code: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) +} +``` + +Remains as-is: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at Test546Kt.main(test546.kt:10) test + +User code: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } +} +``` + +Remains as-is: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at Test547Kt.main(test547.kt:10) test + +User code: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } +} +``` + +Remains as-is: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at Test548Kt.main(test548.kt:10) test + +User code: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at Test549Kt.main(test549.kt:10) test + +User code: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at Test550Kt.main(test550.kt:10) test + +User code: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test551Kt.main(test551.kt:10) test + +User code: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at Test552Kt.main(test552.kt:10) test + +User code: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at Test553Kt.main(test553.kt:10) test + +User code: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test554Kt.main(test554.kt:10) test + +User code: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at Test555Kt.main(test555.kt:10) test + +User code: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test556Kt.main(test556.kt:10) test + +User code: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test557Kt.main(test557.kt:10) test + +User code: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at Test558Kt.main(test558.kt:10) test + +User code: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at Test559Kt.main(test559.kt:10) test + +User code: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at Test560Kt.main(test560.kt:10) test + +User code: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at Test561Kt.main(test561.kt:10) test + +User code: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at Test565Kt.main(test565.kt:10) test + +User code: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at Test566Kt.main(test566.kt:10) test + +User code: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test567Kt.main(test567.kt:10) test + +User code: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at Test568Kt.main(test568.kt:10) test + +User code: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at Test569Kt.main(test569.kt:10) test + +User code: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test570Kt.main(test570.kt:10) test + +User code: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at Test571Kt.main(test571.kt:10) test + +User code: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test572Kt.main(test572.kt:10) test + +User code: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test573Kt.main(test573.kt:10) test + +User code: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}") at Test577Kt.main(test577.kt:10) test + +User code: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") +} +``` + +Remains as-is: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") +} +``` + +
+ +### warn() { "warn messageBuilder" } at Test578Kt.main(test578.kt:10) test + +User code: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } +} +``` + +Remains as-is: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } +} +``` + +### warn() { "warn messageBuilder $i" } at Test579Kt.main(test579.kt:10) test + +User code: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } +} +``` + +Remains as-is: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at Test580Kt.main(test580.kt:10) test + +User code: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at Test581Kt.main(test581.kt:10) test + +User code: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at Test582Kt.main(test582.kt:10) test + +User code: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at Test583Kt.main(test583.kt:10) test + +User code: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at Test584Kt.main(test584.kt:10) test + +User code: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at Test585Kt.main(test585.kt:10) test + +User code: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test586Kt.main(test586.kt:10) test + +User code: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at Test587Kt.main(test587.kt:10) test + +User code: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test588Kt.main(test588.kt:10) test + +User code: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test589Kt.main(test589.kt:10) test + +User code: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at Test590Kt.main(test590.kt:10) test + +User code: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at Test591Kt.main(test591.kt:10) test + +User code: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at Test592Kt.main(test592.kt:10) test + +User code: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at Test593Kt.main(test593.kt:10) test + +User code: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at Test594Kt.main(test594.kt:10) test + +User code: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at Test595Kt.main(test595.kt:10) test + +User code: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at Test596Kt.main(test596.kt:10) test + +User code: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at Test597Kt.main(test597.kt:10) test + +User code: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at Test598Kt.main(test598.kt:10) test + +User code: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test599Kt.main(test599.kt:10) test + +User code: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at Test600Kt.main(test600.kt:10) test + +User code: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at Test601Kt.main(test601.kt:10) test + +User code: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test602Kt.main(test602.kt:10) test + +User code: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at Test603Kt.main(test603.kt:10) test + +User code: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test604Kt.main(test604.kt:10) test + +User code: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test605Kt.main(test605.kt:10) test + +User code: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### error("error message {}", throwable) at Test609Kt.main(test609.kt:10) test + +User code: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) +} +``` + +Remains as-is: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at Test610Kt.main(test610.kt:10) test + +User code: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } +} +``` + +Remains as-is: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } +} +``` + +### error(throwable) { "error messageBuilder $i" } at Test611Kt.main(test611.kt:10) test + +User code: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } +} +``` + +Remains as-is: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at Test612Kt.main(test612.kt:10) test + +User code: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=throwable } at Test613Kt.main(test613.kt:10) test + +User code: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at Test614Kt.main(test614.kt:10) test + +User code: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test615Kt.main(test615.kt:10) test + +User code: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at Test616Kt.main(test616.kt:10) test + +User code: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at Test617Kt.main(test617.kt:10) test + +User code: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test618Kt.main(test618.kt:10) test + +User code: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at Test619Kt.main(test619.kt:10) test + +User code: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test620Kt.main(test620.kt:10) test + +User code: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test621Kt.main(test621.kt:10) test + +User code: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at Test622Kt.main(test622.kt:10) test + +User code: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at Test623Kt.main(test623.kt:10) test + +User code: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at Test624Kt.main(test624.kt:10) test + +User code: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at Test625Kt.main(test625.kt:10) test + +User code: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at Test629Kt.main(test629.kt:10) test + +User code: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at Test630Kt.main(test630.kt:10) test + +User code: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test631Kt.main(test631.kt:10) test + +User code: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at Test632Kt.main(test632.kt:10) test + +User code: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at Test633Kt.main(test633.kt:10) test + +User code: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test634Kt.main(test634.kt:10) test + +User code: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at Test635Kt.main(test635.kt:10) test + +User code: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test636Kt.main(test636.kt:10) test + +User code: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test637Kt.main(test637.kt:10) test + +User code: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### error("error message {}") at Test641Kt.main(test641.kt:10) test + +User code: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") +} +``` + +Remains as-is: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") +} +``` + +
+ +### error() { "error messageBuilder" } at Test642Kt.main(test642.kt:10) test + +User code: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } +} +``` + +Remains as-is: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } +} +``` + +### error() { "error messageBuilder $i" } at Test643Kt.main(test643.kt:10) test + +User code: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } +} +``` + +Remains as-is: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at Test644Kt.main(test644.kt:10) test + +User code: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=null } at Test645Kt.main(test645.kt:10) test + +User code: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at Test646Kt.main(test646.kt:10) test + +User code: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at Test647Kt.main(test647.kt:10) test + +User code: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at Test648Kt.main(test648.kt:10) test + +User code: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at Test649Kt.main(test649.kt:10) test + +User code: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at Test650Kt.main(test650.kt:10) test + +User code: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
+ +
featureFlag=DISABLE_TRANSFORMING_NOT_IMPLEMENTED_API + +
with class=true + +
entry/exit API + +### entry(argument1, argument2) at MainTest.main(test1.kt:10) test + +User code: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) + } + +} +``` + +Transformed into: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entryWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "entry(argument1, argument2)", className = "test1.MainTest", methodName = "main", fileName = "test1.kt", lineNumber = 10)) + } + +} +``` + +### exit(resultValue) at MainTest.main(test2.kt:10) test + +User code: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) + } + +} +``` + +Transformed into: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "exit(resultValue)", className = "test2.MainTest", methodName = "main", fileName = "test2.kt", lineNumber = 10)) + } + +} +``` + +### exit() at MainTest.main(test3.kt:10) test + +User code: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() + } + +} +``` + +Transformed into: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(className = "test3.MainTest", methodName = "main", fileName = "test3.kt", lineNumber = 10)) + } + +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at MainTest.main(test4.kt:10) test + +User code: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) + } + +} +``` + +Transformed into: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "throwing(throwable)", className = "test4.MainTest", methodName = "main", fileName = "test4.kt", lineNumber = 10), throwable) + } + +} +``` + +### catching(throwable) at MainTest.main(test5.kt:10) test + +User code: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) + } + +} +``` + +Transformed into: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catchingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "catching(throwable)", className = "test5.MainTest", methodName = "main", fileName = "test5.kt", lineNumber = 10), throwable) + } + +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at MainTest.main(test6.kt:10) test + +User code: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test7.kt:10) test + +User code: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test8.kt:10) test + +User code: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at MainTest.main(test9.kt:10) test + +User code: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test9.MainTest", methodName = "main", fileName = "test9.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at MainTest.main(test10.kt:10) test + +User code: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test10.MainTest", methodName = "main", fileName = "test10.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test11.kt:10) test + +User code: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test11.MainTest", methodName = "main", fileName = "test11.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at MainTest.main(test12.kt:10) test + +User code: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test12.MainTest", methodName = "main", fileName = "test12.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at MainTest.main(test13.kt:10) test + +User code: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test13.MainTest", methodName = "main", fileName = "test13.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at MainTest.main(test14.kt:10) test + +User code: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test14.MainTest", methodName = "main", fileName = "test14.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test15.kt:10) test + +User code: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test15.MainTest", methodName = "main", fileName = "test15.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test16.kt:10) test + +User code: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test16.MainTest", methodName = "main", fileName = "test16.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test17.kt:10) test + +User code: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test17.MainTest", methodName = "main", fileName = "test17.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test18.kt:10) test + +User code: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test18.MainTest", methodName = "main", fileName = "test18.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test19.kt:10) test + +User code: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test19.MainTest", methodName = "main", fileName = "test19.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test20.kt:10) test + +User code: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test20.MainTest", methodName = "main", fileName = "test20.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test21.kt:10) test + +User code: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test21.MainTest", methodName = "main", fileName = "test21.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at MainTest.main(test22.kt:10) test + +User code: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test23.kt:10) test + +User code: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test24.kt:10) test + +User code: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}", throwable) at MainTest.main(test28.kt:10) test + +User code: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test28.MainTest", methodName = "main", fileName = "test28.kt", lineNumber = 10) + } + +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at MainTest.main(test29.kt:10) test + +User code: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test29.MainTest", methodName = "main", fileName = "test29.kt", lineNumber = 10) + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at MainTest.main(test30.kt:10) test + +User code: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test30.MainTest", methodName = "main", fileName = "test30.kt", lineNumber = 10) + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test31.kt:10) test + +User code: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test31.MainTest", methodName = "main", fileName = "test31.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at MainTest.main(test32.kt:10) test + +User code: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test32.MainTest", methodName = "main", fileName = "test32.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test33.kt:10) test + +User code: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test33.MainTest", methodName = "main", fileName = "test33.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test34.kt:10) test + +User code: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test34.MainTest", methodName = "main", fileName = "test34.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test35.kt:10) test + +User code: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test35.MainTest", methodName = "main", fileName = "test35.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test36.kt:10) test + +User code: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test36.MainTest", methodName = "main", fileName = "test36.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test37.kt:10) test + +User code: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test37.MainTest", methodName = "main", fileName = "test37.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at MainTest.main(test38.kt:10) test + +User code: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test39.kt:10) test + +User code: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test40.kt:10) test + +User code: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at MainTest.main(test41.kt:10) test + +User code: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test41.MainTest", methodName = "main", fileName = "test41.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at MainTest.main(test42.kt:10) test + +User code: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test42.MainTest", methodName = "main", fileName = "test42.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test43.kt:10) test + +User code: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test43.MainTest", methodName = "main", fileName = "test43.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at MainTest.main(test44.kt:10) test + +User code: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test44.MainTest", methodName = "main", fileName = "test44.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test48.kt:10) test + +User code: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test48.MainTest", methodName = "main", fileName = "test48.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test49.kt:10) test + +User code: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test49.MainTest", methodName = "main", fileName = "test49.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test50.kt:10) test + +User code: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test50.MainTest", methodName = "main", fileName = "test50.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test51.kt:10) test + +User code: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test51.MainTest", methodName = "main", fileName = "test51.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test52.kt:10) test + +User code: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test52.MainTest", methodName = "main", fileName = "test52.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test53.kt:10) test + +User code: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test53.MainTest", methodName = "main", fileName = "test53.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at MainTest.main(test54.kt:10) test + +User code: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test55.kt:10) test + +User code: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test56.kt:10) test + +User code: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}") at MainTest.main(test60.kt:10) test + +User code: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") + } + +} +``` + +Transformed into: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test60.MainTest", methodName = "main", fileName = "test60.kt", lineNumber = 10) + } + +} +``` + +
+ +### trace() { "trace messageBuilder" } at MainTest.main(test61.kt:10) test + +User code: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test61.MainTest", methodName = "main", fileName = "test61.kt", lineNumber = 10) + } + +} +``` + +### trace() { "trace messageBuilder $i" } at MainTest.main(test62.kt:10) test + +User code: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test62.MainTest", methodName = "main", fileName = "test62.kt", lineNumber = 10) + } + +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at MainTest.main(test63.kt:10) test + +User code: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test63.MainTest", methodName = "main", fileName = "test63.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at MainTest.main(test64.kt:10) test + +User code: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test64.MainTest", methodName = "main", fileName = "test64.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at MainTest.main(test65.kt:10) test + +User code: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test65.MainTest", methodName = "main", fileName = "test65.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test66.kt:10) test + +User code: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test66.MainTest", methodName = "main", fileName = "test66.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at MainTest.main(test67.kt:10) test + +User code: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test67.MainTest", methodName = "main", fileName = "test67.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test68.kt:10) test + +User code: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test68.MainTest", methodName = "main", fileName = "test68.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test69.kt:10) test + +User code: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test69.MainTest", methodName = "main", fileName = "test69.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at MainTest.main(test70.kt:10) test + +User code: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test71.kt:10) test + +User code: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test72.kt:10) test + +User code: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at MainTest.main(test73.kt:10) test + +User code: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test73.MainTest", methodName = "main", fileName = "test73.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at MainTest.main(test74.kt:10) test + +User code: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test74.MainTest", methodName = "main", fileName = "test74.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test75.kt:10) test + +User code: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test75.MainTest", methodName = "main", fileName = "test75.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at MainTest.main(test76.kt:10) test + +User code: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test76.MainTest", methodName = "main", fileName = "test76.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at MainTest.main(test77.kt:10) test + +User code: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test77.MainTest", methodName = "main", fileName = "test77.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at MainTest.main(test78.kt:10) test + +User code: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test78.MainTest", methodName = "main", fileName = "test78.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test79.kt:10) test + +User code: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test79.MainTest", methodName = "main", fileName = "test79.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test80.kt:10) test + +User code: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test80.MainTest", methodName = "main", fileName = "test80.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test81.kt:10) test + +User code: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test81.MainTest", methodName = "main", fileName = "test81.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test82.kt:10) test + +User code: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test82.MainTest", methodName = "main", fileName = "test82.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test83.kt:10) test + +User code: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test83.MainTest", methodName = "main", fileName = "test83.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test84.kt:10) test + +User code: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test84.MainTest", methodName = "main", fileName = "test84.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test85.kt:10) test + +User code: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test85.MainTest", methodName = "main", fileName = "test85.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at MainTest.main(test86.kt:10) test + +User code: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test87.kt:10) test + +User code: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test88.kt:10) test + +User code: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}", throwable) at MainTest.main(test92.kt:10) test + +User code: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test92.MainTest", methodName = "main", fileName = "test92.kt", lineNumber = 10) + } + +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at MainTest.main(test93.kt:10) test + +User code: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test93.MainTest", methodName = "main", fileName = "test93.kt", lineNumber = 10) + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at MainTest.main(test94.kt:10) test + +User code: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test94.MainTest", methodName = "main", fileName = "test94.kt", lineNumber = 10) + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test95.kt:10) test + +User code: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test95.MainTest", methodName = "main", fileName = "test95.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at MainTest.main(test96.kt:10) test + +User code: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test96.MainTest", methodName = "main", fileName = "test96.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test97.kt:10) test + +User code: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test97.MainTest", methodName = "main", fileName = "test97.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test98.kt:10) test + +User code: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test98.MainTest", methodName = "main", fileName = "test98.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test99.kt:10) test + +User code: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test99.MainTest", methodName = "main", fileName = "test99.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test100.kt:10) test + +User code: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test100.MainTest", methodName = "main", fileName = "test100.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test101.kt:10) test + +User code: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test101.MainTest", methodName = "main", fileName = "test101.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at MainTest.main(test102.kt:10) test + +User code: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test103.kt:10) test + +User code: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test104.kt:10) test + +User code: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at MainTest.main(test105.kt:10) test + +User code: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test105.MainTest", methodName = "main", fileName = "test105.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at MainTest.main(test106.kt:10) test + +User code: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test106.MainTest", methodName = "main", fileName = "test106.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test107.kt:10) test + +User code: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test107.MainTest", methodName = "main", fileName = "test107.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at MainTest.main(test108.kt:10) test + +User code: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test108.MainTest", methodName = "main", fileName = "test108.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test112.kt:10) test + +User code: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test112.MainTest", methodName = "main", fileName = "test112.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test113.kt:10) test + +User code: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test113.MainTest", methodName = "main", fileName = "test113.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test114.kt:10) test + +User code: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test114.MainTest", methodName = "main", fileName = "test114.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test115.kt:10) test + +User code: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test115.MainTest", methodName = "main", fileName = "test115.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test116.kt:10) test + +User code: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test116.MainTest", methodName = "main", fileName = "test116.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test117.kt:10) test + +User code: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test117.MainTest", methodName = "main", fileName = "test117.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at MainTest.main(test118.kt:10) test + +User code: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test119.kt:10) test + +User code: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test120.kt:10) test + +User code: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}") at MainTest.main(test124.kt:10) test + +User code: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") + } + +} +``` + +Transformed into: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test124.MainTest", methodName = "main", fileName = "test124.kt", lineNumber = 10) + } + +} +``` + +
+ +### debug() { "debug messageBuilder" } at MainTest.main(test125.kt:10) test + +User code: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test125.MainTest", methodName = "main", fileName = "test125.kt", lineNumber = 10) + } + +} +``` + +### debug() { "debug messageBuilder $i" } at MainTest.main(test126.kt:10) test + +User code: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test126.MainTest", methodName = "main", fileName = "test126.kt", lineNumber = 10) + } + +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at MainTest.main(test127.kt:10) test + +User code: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test127.MainTest", methodName = "main", fileName = "test127.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at MainTest.main(test128.kt:10) test + +User code: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test128.MainTest", methodName = "main", fileName = "test128.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at MainTest.main(test129.kt:10) test + +User code: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test129.MainTest", methodName = "main", fileName = "test129.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test130.kt:10) test + +User code: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test130.MainTest", methodName = "main", fileName = "test130.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at MainTest.main(test131.kt:10) test + +User code: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test131.MainTest", methodName = "main", fileName = "test131.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test132.kt:10) test + +User code: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test132.MainTest", methodName = "main", fileName = "test132.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test133.kt:10) test + +User code: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test133.MainTest", methodName = "main", fileName = "test133.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at MainTest.main(test134.kt:10) test + +User code: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test135.kt:10) test + +User code: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test136.kt:10) test + +User code: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at MainTest.main(test137.kt:10) test + +User code: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test137.MainTest", methodName = "main", fileName = "test137.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at MainTest.main(test138.kt:10) test + +User code: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test138.MainTest", methodName = "main", fileName = "test138.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test139.kt:10) test + +User code: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test139.MainTest", methodName = "main", fileName = "test139.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at MainTest.main(test140.kt:10) test + +User code: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test140.MainTest", methodName = "main", fileName = "test140.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at MainTest.main(test141.kt:10) test + +User code: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test141.MainTest", methodName = "main", fileName = "test141.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at MainTest.main(test142.kt:10) test + +User code: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test142.MainTest", methodName = "main", fileName = "test142.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test143.kt:10) test + +User code: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test143.MainTest", methodName = "main", fileName = "test143.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test144.kt:10) test + +User code: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test144.MainTest", methodName = "main", fileName = "test144.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test145.kt:10) test + +User code: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test145.MainTest", methodName = "main", fileName = "test145.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test146.kt:10) test + +User code: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test146.MainTest", methodName = "main", fileName = "test146.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test147.kt:10) test + +User code: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test147.MainTest", methodName = "main", fileName = "test147.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test148.kt:10) test + +User code: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test148.MainTest", methodName = "main", fileName = "test148.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test149.kt:10) test + +User code: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test149.MainTest", methodName = "main", fileName = "test149.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at MainTest.main(test150.kt:10) test + +User code: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test151.kt:10) test + +User code: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test152.kt:10) test + +User code: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}", throwable) at MainTest.main(test156.kt:10) test + +User code: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test156.MainTest", methodName = "main", fileName = "test156.kt", lineNumber = 10) + } + +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at MainTest.main(test157.kt:10) test + +User code: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test157.MainTest", methodName = "main", fileName = "test157.kt", lineNumber = 10) + } + +} +``` + +### info(throwable) { "info messageBuilder $i" } at MainTest.main(test158.kt:10) test + +User code: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test158.MainTest", methodName = "main", fileName = "test158.kt", lineNumber = 10) + } + +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test159.kt:10) test + +User code: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test159.MainTest", methodName = "main", fileName = "test159.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at MainTest.main(test160.kt:10) test + +User code: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test160.MainTest", methodName = "main", fileName = "test160.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test161.kt:10) test + +User code: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test161.MainTest", methodName = "main", fileName = "test161.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test162.kt:10) test + +User code: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test162.MainTest", methodName = "main", fileName = "test162.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at MainTest.main(test163.kt:10) test + +User code: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test163.MainTest", methodName = "main", fileName = "test163.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test164.kt:10) test + +User code: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test164.MainTest", methodName = "main", fileName = "test164.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test165.kt:10) test + +User code: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test165.MainTest", methodName = "main", fileName = "test165.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at MainTest.main(test166.kt:10) test + +User code: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test167.kt:10) test + +User code: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test168.kt:10) test + +User code: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at MainTest.main(test169.kt:10) test + +User code: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test169.MainTest", methodName = "main", fileName = "test169.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at MainTest.main(test170.kt:10) test + +User code: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test170.MainTest", methodName = "main", fileName = "test170.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test171.kt:10) test + +User code: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test171.MainTest", methodName = "main", fileName = "test171.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at MainTest.main(test172.kt:10) test + +User code: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test172.MainTest", methodName = "main", fileName = "test172.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at MainTest.main(test176.kt:10) test + +User code: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test176.MainTest", methodName = "main", fileName = "test176.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test177.kt:10) test + +User code: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test177.MainTest", methodName = "main", fileName = "test177.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test178.kt:10) test + +User code: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test178.MainTest", methodName = "main", fileName = "test178.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at MainTest.main(test179.kt:10) test + +User code: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test179.MainTest", methodName = "main", fileName = "test179.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test180.kt:10) test + +User code: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test180.MainTest", methodName = "main", fileName = "test180.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test181.kt:10) test + +User code: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test181.MainTest", methodName = "main", fileName = "test181.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at MainTest.main(test182.kt:10) test + +User code: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test183.kt:10) test + +User code: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test184.kt:10) test + +User code: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}") at MainTest.main(test188.kt:10) test + +User code: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") + } + +} +``` + +Transformed into: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test188.MainTest", methodName = "main", fileName = "test188.kt", lineNumber = 10) + } + +} +``` + +
+ +### info() { "info messageBuilder" } at MainTest.main(test189.kt:10) test + +User code: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test189.MainTest", methodName = "main", fileName = "test189.kt", lineNumber = 10) + } + +} +``` + +### info() { "info messageBuilder $i" } at MainTest.main(test190.kt:10) test + +User code: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test190.MainTest", methodName = "main", fileName = "test190.kt", lineNumber = 10) + } + +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at MainTest.main(test191.kt:10) test + +User code: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test191.MainTest", methodName = "main", fileName = "test191.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=null } at MainTest.main(test192.kt:10) test + +User code: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test192.MainTest", methodName = "main", fileName = "test192.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at MainTest.main(test193.kt:10) test + +User code: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test193.MainTest", methodName = "main", fileName = "test193.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test194.kt:10) test + +User code: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test194.MainTest", methodName = "main", fileName = "test194.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at MainTest.main(test195.kt:10) test + +User code: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test195.MainTest", methodName = "main", fileName = "test195.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at MainTest.main(test196.kt:10) test + +User code: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test196.MainTest", methodName = "main", fileName = "test196.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test197.kt:10) test + +User code: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test197.MainTest", methodName = "main", fileName = "test197.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at MainTest.main(test198.kt:10) test + +User code: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test199.kt:10) test + +User code: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test200.kt:10) test + +User code: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at MainTest.main(test201.kt:10) test + +User code: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test201.MainTest", methodName = "main", fileName = "test201.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at MainTest.main(test202.kt:10) test + +User code: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test202.MainTest", methodName = "main", fileName = "test202.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test203.kt:10) test + +User code: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test203.MainTest", methodName = "main", fileName = "test203.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at MainTest.main(test204.kt:10) test + +User code: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test204.MainTest", methodName = "main", fileName = "test204.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at MainTest.main(test205.kt:10) test + +User code: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test205.MainTest", methodName = "main", fileName = "test205.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at MainTest.main(test206.kt:10) test + +User code: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test206.MainTest", methodName = "main", fileName = "test206.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test207.kt:10) test + +User code: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test207.MainTest", methodName = "main", fileName = "test207.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test208.kt:10) test + +User code: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test208.MainTest", methodName = "main", fileName = "test208.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test209.kt:10) test + +User code: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test209.MainTest", methodName = "main", fileName = "test209.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test210.kt:10) test + +User code: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test210.MainTest", methodName = "main", fileName = "test210.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test211.kt:10) test + +User code: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test211.MainTest", methodName = "main", fileName = "test211.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test212.kt:10) test + +User code: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test212.MainTest", methodName = "main", fileName = "test212.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test213.kt:10) test + +User code: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test213.MainTest", methodName = "main", fileName = "test213.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at MainTest.main(test214.kt:10) test + +User code: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test215.kt:10) test + +User code: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test216.kt:10) test + +User code: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}", throwable) at MainTest.main(test220.kt:10) test + +User code: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test220.MainTest", methodName = "main", fileName = "test220.kt", lineNumber = 10) + } + +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at MainTest.main(test221.kt:10) test + +User code: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test221.MainTest", methodName = "main", fileName = "test221.kt", lineNumber = 10) + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at MainTest.main(test222.kt:10) test + +User code: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test222.MainTest", methodName = "main", fileName = "test222.kt", lineNumber = 10) + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test223.kt:10) test + +User code: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test223.MainTest", methodName = "main", fileName = "test223.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at MainTest.main(test224.kt:10) test + +User code: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test224.MainTest", methodName = "main", fileName = "test224.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test225.kt:10) test + +User code: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test225.MainTest", methodName = "main", fileName = "test225.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test226.kt:10) test + +User code: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test226.MainTest", methodName = "main", fileName = "test226.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test227.kt:10) test + +User code: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test227.MainTest", methodName = "main", fileName = "test227.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test228.kt:10) test + +User code: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test228.MainTest", methodName = "main", fileName = "test228.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test229.kt:10) test + +User code: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test229.MainTest", methodName = "main", fileName = "test229.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at MainTest.main(test230.kt:10) test + +User code: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test231.kt:10) test + +User code: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test232.kt:10) test + +User code: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at MainTest.main(test233.kt:10) test + +User code: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test233.MainTest", methodName = "main", fileName = "test233.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at MainTest.main(test234.kt:10) test + +User code: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test234.MainTest", methodName = "main", fileName = "test234.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test235.kt:10) test + +User code: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test235.MainTest", methodName = "main", fileName = "test235.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at MainTest.main(test236.kt:10) test + +User code: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test236.MainTest", methodName = "main", fileName = "test236.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test240.kt:10) test + +User code: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test240.MainTest", methodName = "main", fileName = "test240.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test241.kt:10) test + +User code: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test241.MainTest", methodName = "main", fileName = "test241.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test242.kt:10) test + +User code: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test242.MainTest", methodName = "main", fileName = "test242.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test243.kt:10) test + +User code: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test243.MainTest", methodName = "main", fileName = "test243.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test244.kt:10) test + +User code: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test244.MainTest", methodName = "main", fileName = "test244.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test245.kt:10) test + +User code: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test245.MainTest", methodName = "main", fileName = "test245.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at MainTest.main(test246.kt:10) test + +User code: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test247.kt:10) test + +User code: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test248.kt:10) test + +User code: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}") at MainTest.main(test252.kt:10) test + +User code: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") + } + +} +``` + +Transformed into: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test252.MainTest", methodName = "main", fileName = "test252.kt", lineNumber = 10) + } + +} +``` + +
+ +### warn() { "warn messageBuilder" } at MainTest.main(test253.kt:10) test + +User code: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test253.MainTest", methodName = "main", fileName = "test253.kt", lineNumber = 10) + } + +} +``` + +### warn() { "warn messageBuilder $i" } at MainTest.main(test254.kt:10) test + +User code: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test254.MainTest", methodName = "main", fileName = "test254.kt", lineNumber = 10) + } + +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at MainTest.main(test255.kt:10) test + +User code: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test255.MainTest", methodName = "main", fileName = "test255.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at MainTest.main(test256.kt:10) test + +User code: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test256.MainTest", methodName = "main", fileName = "test256.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at MainTest.main(test257.kt:10) test + +User code: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test257.MainTest", methodName = "main", fileName = "test257.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test258.kt:10) test + +User code: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test258.MainTest", methodName = "main", fileName = "test258.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at MainTest.main(test259.kt:10) test + +User code: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test259.MainTest", methodName = "main", fileName = "test259.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test260.kt:10) test + +User code: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test260.MainTest", methodName = "main", fileName = "test260.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test261.kt:10) test + +User code: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test261.MainTest", methodName = "main", fileName = "test261.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at MainTest.main(test262.kt:10) test + +User code: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test263.kt:10) test + +User code: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test264.kt:10) test + +User code: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at MainTest.main(test265.kt:10) test + +User code: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test265.MainTest", methodName = "main", fileName = "test265.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at MainTest.main(test266.kt:10) test + +User code: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test266.MainTest", methodName = "main", fileName = "test266.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test267.kt:10) test + +User code: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test267.MainTest", methodName = "main", fileName = "test267.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at MainTest.main(test268.kt:10) test + +User code: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test268.MainTest", methodName = "main", fileName = "test268.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at MainTest.main(test269.kt:10) test + +User code: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test269.MainTest", methodName = "main", fileName = "test269.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at MainTest.main(test270.kt:10) test + +User code: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test270.MainTest", methodName = "main", fileName = "test270.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test271.kt:10) test + +User code: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test271.MainTest", methodName = "main", fileName = "test271.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test272.kt:10) test + +User code: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test272.MainTest", methodName = "main", fileName = "test272.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test273.kt:10) test + +User code: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test273.MainTest", methodName = "main", fileName = "test273.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test274.kt:10) test + +User code: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test274.MainTest", methodName = "main", fileName = "test274.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test275.kt:10) test + +User code: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test275.MainTest", methodName = "main", fileName = "test275.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test276.kt:10) test + +User code: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test276.MainTest", methodName = "main", fileName = "test276.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test277.kt:10) test + +User code: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test277.MainTest", methodName = "main", fileName = "test277.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at MainTest.main(test278.kt:10) test + +User code: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test279.kt:10) test + +User code: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test280.kt:10) test + +User code: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}", throwable) at MainTest.main(test284.kt:10) test + +User code: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test284.MainTest", methodName = "main", fileName = "test284.kt", lineNumber = 10) + } + +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at MainTest.main(test285.kt:10) test + +User code: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test285.MainTest", methodName = "main", fileName = "test285.kt", lineNumber = 10) + } + +} +``` + +### error(throwable) { "error messageBuilder $i" } at MainTest.main(test286.kt:10) test + +User code: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test286.MainTest", methodName = "main", fileName = "test286.kt", lineNumber = 10) + } + +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test287.kt:10) test + +User code: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test287.MainTest", methodName = "main", fileName = "test287.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=throwable } at MainTest.main(test288.kt:10) test + +User code: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test288.MainTest", methodName = "main", fileName = "test288.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test289.kt:10) test + +User code: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test289.MainTest", methodName = "main", fileName = "test289.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test290.kt:10) test + +User code: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test290.MainTest", methodName = "main", fileName = "test290.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at MainTest.main(test291.kt:10) test + +User code: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test291.MainTest", methodName = "main", fileName = "test291.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test292.kt:10) test + +User code: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test292.MainTest", methodName = "main", fileName = "test292.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test293.kt:10) test + +User code: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test293.MainTest", methodName = "main", fileName = "test293.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at MainTest.main(test294.kt:10) test + +User code: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test295.kt:10) test + +User code: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test296.kt:10) test + +User code: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at MainTest.main(test297.kt:10) test + +User code: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test297.MainTest", methodName = "main", fileName = "test297.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at MainTest.main(test298.kt:10) test + +User code: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test298.MainTest", methodName = "main", fileName = "test298.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test299.kt:10) test + +User code: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test299.MainTest", methodName = "main", fileName = "test299.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at MainTest.main(test300.kt:10) test + +User code: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test300.MainTest", methodName = "main", fileName = "test300.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at MainTest.main(test304.kt:10) test + +User code: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test304.MainTest", methodName = "main", fileName = "test304.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test305.kt:10) test + +User code: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test305.MainTest", methodName = "main", fileName = "test305.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test306.kt:10) test + +User code: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test306.MainTest", methodName = "main", fileName = "test306.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at MainTest.main(test307.kt:10) test + +User code: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test307.MainTest", methodName = "main", fileName = "test307.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test308.kt:10) test + +User code: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test308.MainTest", methodName = "main", fileName = "test308.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test309.kt:10) test + +User code: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test309.MainTest", methodName = "main", fileName = "test309.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at MainTest.main(test310.kt:10) test + +User code: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test311.kt:10) test + +User code: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test312.kt:10) test + +User code: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}") at MainTest.main(test316.kt:10) test + +User code: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") + } + +} +``` + +Transformed into: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test316.MainTest", methodName = "main", fileName = "test316.kt", lineNumber = 10) + } + +} +``` + +
+ +### error() { "error messageBuilder" } at MainTest.main(test317.kt:10) test + +User code: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test317.MainTest", methodName = "main", fileName = "test317.kt", lineNumber = 10) + } + +} +``` + +### error() { "error messageBuilder $i" } at MainTest.main(test318.kt:10) test + +User code: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test318.MainTest", methodName = "main", fileName = "test318.kt", lineNumber = 10) + } + +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at MainTest.main(test319.kt:10) test + +User code: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test319.MainTest", methodName = "main", fileName = "test319.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=null } at MainTest.main(test320.kt:10) test + +User code: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test320.MainTest", methodName = "main", fileName = "test320.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at MainTest.main(test321.kt:10) test + +User code: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test321.MainTest", methodName = "main", fileName = "test321.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test322.kt:10) test + +User code: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test322.MainTest", methodName = "main", fileName = "test322.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at MainTest.main(test323.kt:10) test + +User code: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test323.MainTest", methodName = "main", fileName = "test323.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at MainTest.main(test324.kt:10) test + +User code: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test324.MainTest", methodName = "main", fileName = "test324.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test325.kt:10) test + +User code: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test325.MainTest", methodName = "main", fileName = "test325.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
+ +
with class=false + +
entry/exit API + +### entry(argument1, argument2) at Test326Kt.main(test326.kt:10) test + +User code: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) +} +``` + +Transformed into: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entryWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "entry(argument1, argument2)", className = "test326.Test326Kt", methodName = "main", fileName = "test326.kt", lineNumber = 10)) +} +``` + +### exit(resultValue) at Test327Kt.main(test327.kt:10) test + +User code: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) +} +``` + +Transformed into: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "exit(resultValue)", className = "test327.Test327Kt", methodName = "main", fileName = "test327.kt", lineNumber = 10)) +} +``` + +### exit() at Test328Kt.main(test328.kt:10) test + +User code: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() +} +``` + +Transformed into: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(className = "test328.Test328Kt", methodName = "main", fileName = "test328.kt", lineNumber = 10)) +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at Test329Kt.main(test329.kt:10) test + +User code: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) +} +``` + +Transformed into: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "throwing(throwable)", className = "test329.Test329Kt", methodName = "main", fileName = "test329.kt", lineNumber = 10), throwable) +} +``` + +### catching(throwable) at Test330Kt.main(test330.kt:10) test + +User code: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) +} +``` + +Transformed into: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catchingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "catching(throwable)", className = "test330.Test330Kt", methodName = "main", fileName = "test330.kt", lineNumber = 10), throwable) +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at Test331Kt.main(test331.kt:10) test + +User code: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test332Kt.main(test332.kt:10) test + +User code: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test333Kt.main(test333.kt:10) test + +User code: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at Test334Kt.main(test334.kt:10) test + +User code: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test334.Test334Kt", methodName = "main", fileName = "test334.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at Test335Kt.main(test335.kt:10) test + +User code: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test335.Test335Kt", methodName = "main", fileName = "test335.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at Test336Kt.main(test336.kt:10) test + +User code: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test336.Test336Kt", methodName = "main", fileName = "test336.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at Test337Kt.main(test337.kt:10) test + +User code: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test337.Test337Kt", methodName = "main", fileName = "test337.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at Test338Kt.main(test338.kt:10) test + +User code: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test338.Test338Kt", methodName = "main", fileName = "test338.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at Test339Kt.main(test339.kt:10) test + +User code: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test339.Test339Kt", methodName = "main", fileName = "test339.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at Test340Kt.main(test340.kt:10) test + +User code: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test340.Test340Kt", methodName = "main", fileName = "test340.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at Test341Kt.main(test341.kt:10) test + +User code: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test341.Test341Kt", methodName = "main", fileName = "test341.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at Test342Kt.main(test342.kt:10) test + +User code: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test342.Test342Kt", methodName = "main", fileName = "test342.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test343Kt.main(test343.kt:10) test + +User code: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test343.Test343Kt", methodName = "main", fileName = "test343.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at Test344Kt.main(test344.kt:10) test + +User code: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test344.Test344Kt", methodName = "main", fileName = "test344.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at Test345Kt.main(test345.kt:10) test + +User code: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test345.Test345Kt", methodName = "main", fileName = "test345.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test346Kt.main(test346.kt:10) test + +User code: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test346.Test346Kt", methodName = "main", fileName = "test346.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at Test347Kt.main(test347.kt:10) test + +User code: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test348Kt.main(test348.kt:10) test + +User code: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test349Kt.main(test349.kt:10) test + +User code: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}", throwable) at Test353Kt.main(test353.kt:10) test + +User code: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test353.Test353Kt", methodName = "main", fileName = "test353.kt", lineNumber = 10) +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at Test354Kt.main(test354.kt:10) test + +User code: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test354.Test354Kt", methodName = "main", fileName = "test354.kt", lineNumber = 10) +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at Test355Kt.main(test355.kt:10) test + +User code: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test355.Test355Kt", methodName = "main", fileName = "test355.kt", lineNumber = 10) +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at Test356Kt.main(test356.kt:10) test + +User code: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test356.Test356Kt", methodName = "main", fileName = "test356.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at Test357Kt.main(test357.kt:10) test + +User code: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test357.Test357Kt", methodName = "main", fileName = "test357.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at Test358Kt.main(test358.kt:10) test + +User code: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test358.Test358Kt", methodName = "main", fileName = "test358.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test359Kt.main(test359.kt:10) test + +User code: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test359.Test359Kt", methodName = "main", fileName = "test359.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at Test360Kt.main(test360.kt:10) test + +User code: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test360.Test360Kt", methodName = "main", fileName = "test360.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at Test361Kt.main(test361.kt:10) test + +User code: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test361.Test361Kt", methodName = "main", fileName = "test361.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test362Kt.main(test362.kt:10) test + +User code: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test362.Test362Kt", methodName = "main", fileName = "test362.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at Test363Kt.main(test363.kt:10) test + +User code: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test364Kt.main(test364.kt:10) test + +User code: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test365Kt.main(test365.kt:10) test + +User code: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at Test366Kt.main(test366.kt:10) test + +User code: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test366.Test366Kt", methodName = "main", fileName = "test366.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at Test367Kt.main(test367.kt:10) test + +User code: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test367.Test367Kt", methodName = "main", fileName = "test367.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at Test368Kt.main(test368.kt:10) test + +User code: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test368.Test368Kt", methodName = "main", fileName = "test368.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at Test369Kt.main(test369.kt:10) test + +User code: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test369.Test369Kt", methodName = "main", fileName = "test369.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at Test373Kt.main(test373.kt:10) test + +User code: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test373.Test373Kt", methodName = "main", fileName = "test373.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at Test374Kt.main(test374.kt:10) test + +User code: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test374.Test374Kt", methodName = "main", fileName = "test374.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test375Kt.main(test375.kt:10) test + +User code: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test375.Test375Kt", methodName = "main", fileName = "test375.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at Test376Kt.main(test376.kt:10) test + +User code: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test376.Test376Kt", methodName = "main", fileName = "test376.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at Test377Kt.main(test377.kt:10) test + +User code: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test377.Test377Kt", methodName = "main", fileName = "test377.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test378Kt.main(test378.kt:10) test + +User code: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test378.Test378Kt", methodName = "main", fileName = "test378.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at Test379Kt.main(test379.kt:10) test + +User code: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test380Kt.main(test380.kt:10) test + +User code: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test381Kt.main(test381.kt:10) test + +User code: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}") at Test385Kt.main(test385.kt:10) test + +User code: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") +} +``` + +Transformed into: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test385.Test385Kt", methodName = "main", fileName = "test385.kt", lineNumber = 10) +} +``` + +
+ +### trace() { "trace messageBuilder" } at Test386Kt.main(test386.kt:10) test + +User code: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test386.Test386Kt", methodName = "main", fileName = "test386.kt", lineNumber = 10) +} +``` + +### trace() { "trace messageBuilder $i" } at Test387Kt.main(test387.kt:10) test + +User code: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test387.Test387Kt", methodName = "main", fileName = "test387.kt", lineNumber = 10) +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at Test388Kt.main(test388.kt:10) test + +User code: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test388.Test388Kt", methodName = "main", fileName = "test388.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at Test389Kt.main(test389.kt:10) test + +User code: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test389.Test389Kt", methodName = "main", fileName = "test389.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at Test390Kt.main(test390.kt:10) test + +User code: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test390.Test390Kt", methodName = "main", fileName = "test390.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at Test391Kt.main(test391.kt:10) test + +User code: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test391.Test391Kt", methodName = "main", fileName = "test391.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at Test392Kt.main(test392.kt:10) test + +User code: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test392.Test392Kt", methodName = "main", fileName = "test392.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at Test393Kt.main(test393.kt:10) test + +User code: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test393.Test393Kt", methodName = "main", fileName = "test393.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test394Kt.main(test394.kt:10) test + +User code: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test394.Test394Kt", methodName = "main", fileName = "test394.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at Test395Kt.main(test395.kt:10) test + +User code: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test396Kt.main(test396.kt:10) test + +User code: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test397Kt.main(test397.kt:10) test + +User code: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at Test398Kt.main(test398.kt:10) test + +User code: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test398.Test398Kt", methodName = "main", fileName = "test398.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at Test399Kt.main(test399.kt:10) test + +User code: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test399.Test399Kt", methodName = "main", fileName = "test399.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at Test400Kt.main(test400.kt:10) test + +User code: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test400.Test400Kt", methodName = "main", fileName = "test400.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at Test401Kt.main(test401.kt:10) test + +User code: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test401.Test401Kt", methodName = "main", fileName = "test401.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at Test402Kt.main(test402.kt:10) test + +User code: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test402.Test402Kt", methodName = "main", fileName = "test402.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at Test403Kt.main(test403.kt:10) test + +User code: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test403.Test403Kt", methodName = "main", fileName = "test403.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at Test404Kt.main(test404.kt:10) test + +User code: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test404.Test404Kt", methodName = "main", fileName = "test404.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at Test405Kt.main(test405.kt:10) test + +User code: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test405.Test405Kt", methodName = "main", fileName = "test405.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at Test406Kt.main(test406.kt:10) test + +User code: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test406.Test406Kt", methodName = "main", fileName = "test406.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test407Kt.main(test407.kt:10) test + +User code: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test407.Test407Kt", methodName = "main", fileName = "test407.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at Test408Kt.main(test408.kt:10) test + +User code: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test408.Test408Kt", methodName = "main", fileName = "test408.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at Test409Kt.main(test409.kt:10) test + +User code: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test409.Test409Kt", methodName = "main", fileName = "test409.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test410Kt.main(test410.kt:10) test + +User code: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test410.Test410Kt", methodName = "main", fileName = "test410.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at Test411Kt.main(test411.kt:10) test + +User code: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test412Kt.main(test412.kt:10) test + +User code: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test413Kt.main(test413.kt:10) test + +User code: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}", throwable) at Test417Kt.main(test417.kt:10) test + +User code: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test417.Test417Kt", methodName = "main", fileName = "test417.kt", lineNumber = 10) +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at Test418Kt.main(test418.kt:10) test + +User code: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test418.Test418Kt", methodName = "main", fileName = "test418.kt", lineNumber = 10) +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at Test419Kt.main(test419.kt:10) test + +User code: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test419.Test419Kt", methodName = "main", fileName = "test419.kt", lineNumber = 10) +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at Test420Kt.main(test420.kt:10) test + +User code: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test420.Test420Kt", methodName = "main", fileName = "test420.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at Test421Kt.main(test421.kt:10) test + +User code: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test421.Test421Kt", methodName = "main", fileName = "test421.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at Test422Kt.main(test422.kt:10) test + +User code: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test422.Test422Kt", methodName = "main", fileName = "test422.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test423Kt.main(test423.kt:10) test + +User code: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test423.Test423Kt", methodName = "main", fileName = "test423.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at Test424Kt.main(test424.kt:10) test + +User code: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test424.Test424Kt", methodName = "main", fileName = "test424.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at Test425Kt.main(test425.kt:10) test + +User code: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test425.Test425Kt", methodName = "main", fileName = "test425.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test426Kt.main(test426.kt:10) test + +User code: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test426.Test426Kt", methodName = "main", fileName = "test426.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at Test427Kt.main(test427.kt:10) test + +User code: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test428Kt.main(test428.kt:10) test + +User code: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test429Kt.main(test429.kt:10) test + +User code: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at Test430Kt.main(test430.kt:10) test + +User code: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test430.Test430Kt", methodName = "main", fileName = "test430.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at Test431Kt.main(test431.kt:10) test + +User code: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test431.Test431Kt", methodName = "main", fileName = "test431.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at Test432Kt.main(test432.kt:10) test + +User code: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test432.Test432Kt", methodName = "main", fileName = "test432.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at Test433Kt.main(test433.kt:10) test + +User code: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test433.Test433Kt", methodName = "main", fileName = "test433.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at Test437Kt.main(test437.kt:10) test + +User code: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test437.Test437Kt", methodName = "main", fileName = "test437.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at Test438Kt.main(test438.kt:10) test + +User code: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test438.Test438Kt", methodName = "main", fileName = "test438.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test439Kt.main(test439.kt:10) test + +User code: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test439.Test439Kt", methodName = "main", fileName = "test439.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at Test440Kt.main(test440.kt:10) test + +User code: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test440.Test440Kt", methodName = "main", fileName = "test440.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at Test441Kt.main(test441.kt:10) test + +User code: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test441.Test441Kt", methodName = "main", fileName = "test441.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test442Kt.main(test442.kt:10) test + +User code: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test442.Test442Kt", methodName = "main", fileName = "test442.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at Test443Kt.main(test443.kt:10) test + +User code: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test444Kt.main(test444.kt:10) test + +User code: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test445Kt.main(test445.kt:10) test + +User code: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}") at Test449Kt.main(test449.kt:10) test + +User code: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") +} +``` + +Transformed into: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test449.Test449Kt", methodName = "main", fileName = "test449.kt", lineNumber = 10) +} +``` + +
+ +### debug() { "debug messageBuilder" } at Test450Kt.main(test450.kt:10) test + +User code: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test450.Test450Kt", methodName = "main", fileName = "test450.kt", lineNumber = 10) +} +``` + +### debug() { "debug messageBuilder $i" } at Test451Kt.main(test451.kt:10) test + +User code: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test451.Test451Kt", methodName = "main", fileName = "test451.kt", lineNumber = 10) +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at Test452Kt.main(test452.kt:10) test + +User code: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test452.Test452Kt", methodName = "main", fileName = "test452.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at Test453Kt.main(test453.kt:10) test + +User code: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test453.Test453Kt", methodName = "main", fileName = "test453.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at Test454Kt.main(test454.kt:10) test + +User code: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test454.Test454Kt", methodName = "main", fileName = "test454.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at Test455Kt.main(test455.kt:10) test + +User code: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test455.Test455Kt", methodName = "main", fileName = "test455.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at Test456Kt.main(test456.kt:10) test + +User code: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test456.Test456Kt", methodName = "main", fileName = "test456.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at Test457Kt.main(test457.kt:10) test + +User code: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test457.Test457Kt", methodName = "main", fileName = "test457.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test458Kt.main(test458.kt:10) test + +User code: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test458.Test458Kt", methodName = "main", fileName = "test458.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at Test459Kt.main(test459.kt:10) test + +User code: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test460Kt.main(test460.kt:10) test + +User code: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test461Kt.main(test461.kt:10) test + +User code: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at Test462Kt.main(test462.kt:10) test + +User code: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test462.Test462Kt", methodName = "main", fileName = "test462.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at Test463Kt.main(test463.kt:10) test + +User code: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test463.Test463Kt", methodName = "main", fileName = "test463.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at Test464Kt.main(test464.kt:10) test + +User code: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test464.Test464Kt", methodName = "main", fileName = "test464.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at Test465Kt.main(test465.kt:10) test + +User code: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test465.Test465Kt", methodName = "main", fileName = "test465.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at Test466Kt.main(test466.kt:10) test + +User code: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test466.Test466Kt", methodName = "main", fileName = "test466.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at Test467Kt.main(test467.kt:10) test + +User code: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test467.Test467Kt", methodName = "main", fileName = "test467.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at Test468Kt.main(test468.kt:10) test + +User code: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test468.Test468Kt", methodName = "main", fileName = "test468.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at Test469Kt.main(test469.kt:10) test + +User code: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test469.Test469Kt", methodName = "main", fileName = "test469.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at Test470Kt.main(test470.kt:10) test + +User code: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test470.Test470Kt", methodName = "main", fileName = "test470.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test471Kt.main(test471.kt:10) test + +User code: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test471.Test471Kt", methodName = "main", fileName = "test471.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at Test472Kt.main(test472.kt:10) test + +User code: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test472.Test472Kt", methodName = "main", fileName = "test472.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at Test473Kt.main(test473.kt:10) test + +User code: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test473.Test473Kt", methodName = "main", fileName = "test473.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test474Kt.main(test474.kt:10) test + +User code: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test474.Test474Kt", methodName = "main", fileName = "test474.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at Test475Kt.main(test475.kt:10) test + +User code: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test476Kt.main(test476.kt:10) test + +User code: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test477Kt.main(test477.kt:10) test + +User code: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### info("info message {}", throwable) at Test481Kt.main(test481.kt:10) test + +User code: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test481.Test481Kt", methodName = "main", fileName = "test481.kt", lineNumber = 10) +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at Test482Kt.main(test482.kt:10) test + +User code: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test482.Test482Kt", methodName = "main", fileName = "test482.kt", lineNumber = 10) +} +``` + +### info(throwable) { "info messageBuilder $i" } at Test483Kt.main(test483.kt:10) test + +User code: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test483.Test483Kt", methodName = "main", fileName = "test483.kt", lineNumber = 10) +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at Test484Kt.main(test484.kt:10) test + +User code: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test484.Test484Kt", methodName = "main", fileName = "test484.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at Test485Kt.main(test485.kt:10) test + +User code: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test485.Test485Kt", methodName = "main", fileName = "test485.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at Test486Kt.main(test486.kt:10) test + +User code: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test486.Test486Kt", methodName = "main", fileName = "test486.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test487Kt.main(test487.kt:10) test + +User code: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test487.Test487Kt", methodName = "main", fileName = "test487.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at Test488Kt.main(test488.kt:10) test + +User code: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test488.Test488Kt", methodName = "main", fileName = "test488.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at Test489Kt.main(test489.kt:10) test + +User code: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test489.Test489Kt", methodName = "main", fileName = "test489.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test490Kt.main(test490.kt:10) test + +User code: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test490.Test490Kt", methodName = "main", fileName = "test490.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at Test491Kt.main(test491.kt:10) test + +User code: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test492Kt.main(test492.kt:10) test + +User code: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test493Kt.main(test493.kt:10) test + +User code: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at Test494Kt.main(test494.kt:10) test + +User code: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test494.Test494Kt", methodName = "main", fileName = "test494.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at Test495Kt.main(test495.kt:10) test + +User code: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test495.Test495Kt", methodName = "main", fileName = "test495.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at Test496Kt.main(test496.kt:10) test + +User code: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test496.Test496Kt", methodName = "main", fileName = "test496.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at Test497Kt.main(test497.kt:10) test + +User code: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test497.Test497Kt", methodName = "main", fileName = "test497.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at Test501Kt.main(test501.kt:10) test + +User code: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test501.Test501Kt", methodName = "main", fileName = "test501.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at Test502Kt.main(test502.kt:10) test + +User code: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test502.Test502Kt", methodName = "main", fileName = "test502.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test503Kt.main(test503.kt:10) test + +User code: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test503.Test503Kt", methodName = "main", fileName = "test503.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at Test504Kt.main(test504.kt:10) test + +User code: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test504.Test504Kt", methodName = "main", fileName = "test504.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at Test505Kt.main(test505.kt:10) test + +User code: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test505.Test505Kt", methodName = "main", fileName = "test505.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test506Kt.main(test506.kt:10) test + +User code: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test506.Test506Kt", methodName = "main", fileName = "test506.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at Test507Kt.main(test507.kt:10) test + +User code: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test508Kt.main(test508.kt:10) test + +User code: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test509Kt.main(test509.kt:10) test + +User code: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### info("info message {}") at Test513Kt.main(test513.kt:10) test + +User code: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") +} +``` + +Transformed into: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test513.Test513Kt", methodName = "main", fileName = "test513.kt", lineNumber = 10) +} +``` + +
+ +### info() { "info messageBuilder" } at Test514Kt.main(test514.kt:10) test + +User code: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test514.Test514Kt", methodName = "main", fileName = "test514.kt", lineNumber = 10) +} +``` + +### info() { "info messageBuilder $i" } at Test515Kt.main(test515.kt:10) test + +User code: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test515.Test515Kt", methodName = "main", fileName = "test515.kt", lineNumber = 10) +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at Test516Kt.main(test516.kt:10) test + +User code: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test516.Test516Kt", methodName = "main", fileName = "test516.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=null } at Test517Kt.main(test517.kt:10) test + +User code: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test517.Test517Kt", methodName = "main", fileName = "test517.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at Test518Kt.main(test518.kt:10) test + +User code: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test518.Test518Kt", methodName = "main", fileName = "test518.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at Test519Kt.main(test519.kt:10) test + +User code: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test519.Test519Kt", methodName = "main", fileName = "test519.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at Test520Kt.main(test520.kt:10) test + +User code: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test520.Test520Kt", methodName = "main", fileName = "test520.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at Test521Kt.main(test521.kt:10) test + +User code: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test521.Test521Kt", methodName = "main", fileName = "test521.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at Test522Kt.main(test522.kt:10) test + +User code: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test522.Test522Kt", methodName = "main", fileName = "test522.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at Test523Kt.main(test523.kt:10) test + +User code: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test524Kt.main(test524.kt:10) test + +User code: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test525Kt.main(test525.kt:10) test + +User code: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at Test526Kt.main(test526.kt:10) test + +User code: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test526.Test526Kt", methodName = "main", fileName = "test526.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at Test527Kt.main(test527.kt:10) test + +User code: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test527.Test527Kt", methodName = "main", fileName = "test527.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at Test528Kt.main(test528.kt:10) test + +User code: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test528.Test528Kt", methodName = "main", fileName = "test528.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at Test529Kt.main(test529.kt:10) test + +User code: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test529.Test529Kt", methodName = "main", fileName = "test529.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at Test530Kt.main(test530.kt:10) test + +User code: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test530.Test530Kt", methodName = "main", fileName = "test530.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at Test531Kt.main(test531.kt:10) test + +User code: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test531.Test531Kt", methodName = "main", fileName = "test531.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at Test532Kt.main(test532.kt:10) test + +User code: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test532.Test532Kt", methodName = "main", fileName = "test532.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at Test533Kt.main(test533.kt:10) test + +User code: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test533.Test533Kt", methodName = "main", fileName = "test533.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at Test534Kt.main(test534.kt:10) test + +User code: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test534.Test534Kt", methodName = "main", fileName = "test534.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test535Kt.main(test535.kt:10) test + +User code: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test535.Test535Kt", methodName = "main", fileName = "test535.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at Test536Kt.main(test536.kt:10) test + +User code: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test536.Test536Kt", methodName = "main", fileName = "test536.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at Test537Kt.main(test537.kt:10) test + +User code: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test537.Test537Kt", methodName = "main", fileName = "test537.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test538Kt.main(test538.kt:10) test + +User code: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test538.Test538Kt", methodName = "main", fileName = "test538.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at Test539Kt.main(test539.kt:10) test + +User code: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test540Kt.main(test540.kt:10) test + +User code: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test541Kt.main(test541.kt:10) test + +User code: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}", throwable) at Test545Kt.main(test545.kt:10) test + +User code: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test545.Test545Kt", methodName = "main", fileName = "test545.kt", lineNumber = 10) +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at Test546Kt.main(test546.kt:10) test + +User code: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test546.Test546Kt", methodName = "main", fileName = "test546.kt", lineNumber = 10) +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at Test547Kt.main(test547.kt:10) test + +User code: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test547.Test547Kt", methodName = "main", fileName = "test547.kt", lineNumber = 10) +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at Test548Kt.main(test548.kt:10) test + +User code: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test548.Test548Kt", methodName = "main", fileName = "test548.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at Test549Kt.main(test549.kt:10) test + +User code: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test549.Test549Kt", methodName = "main", fileName = "test549.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at Test550Kt.main(test550.kt:10) test + +User code: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test550.Test550Kt", methodName = "main", fileName = "test550.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test551Kt.main(test551.kt:10) test + +User code: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test551.Test551Kt", methodName = "main", fileName = "test551.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at Test552Kt.main(test552.kt:10) test + +User code: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test552.Test552Kt", methodName = "main", fileName = "test552.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at Test553Kt.main(test553.kt:10) test + +User code: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test553.Test553Kt", methodName = "main", fileName = "test553.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test554Kt.main(test554.kt:10) test + +User code: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test554.Test554Kt", methodName = "main", fileName = "test554.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at Test555Kt.main(test555.kt:10) test + +User code: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test556Kt.main(test556.kt:10) test + +User code: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test557Kt.main(test557.kt:10) test + +User code: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at Test558Kt.main(test558.kt:10) test + +User code: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test558.Test558Kt", methodName = "main", fileName = "test558.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at Test559Kt.main(test559.kt:10) test + +User code: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test559.Test559Kt", methodName = "main", fileName = "test559.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at Test560Kt.main(test560.kt:10) test + +User code: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test560.Test560Kt", methodName = "main", fileName = "test560.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at Test561Kt.main(test561.kt:10) test + +User code: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test561.Test561Kt", methodName = "main", fileName = "test561.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at Test565Kt.main(test565.kt:10) test + +User code: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test565.Test565Kt", methodName = "main", fileName = "test565.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at Test566Kt.main(test566.kt:10) test + +User code: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test566.Test566Kt", methodName = "main", fileName = "test566.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test567Kt.main(test567.kt:10) test + +User code: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test567.Test567Kt", methodName = "main", fileName = "test567.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at Test568Kt.main(test568.kt:10) test + +User code: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test568.Test568Kt", methodName = "main", fileName = "test568.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at Test569Kt.main(test569.kt:10) test + +User code: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test569.Test569Kt", methodName = "main", fileName = "test569.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test570Kt.main(test570.kt:10) test + +User code: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test570.Test570Kt", methodName = "main", fileName = "test570.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at Test571Kt.main(test571.kt:10) test + +User code: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test572Kt.main(test572.kt:10) test + +User code: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test573Kt.main(test573.kt:10) test + +User code: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}") at Test577Kt.main(test577.kt:10) test + +User code: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") +} +``` + +Transformed into: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test577.Test577Kt", methodName = "main", fileName = "test577.kt", lineNumber = 10) +} +``` + +
+ +### warn() { "warn messageBuilder" } at Test578Kt.main(test578.kt:10) test + +User code: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test578.Test578Kt", methodName = "main", fileName = "test578.kt", lineNumber = 10) +} +``` + +### warn() { "warn messageBuilder $i" } at Test579Kt.main(test579.kt:10) test + +User code: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test579.Test579Kt", methodName = "main", fileName = "test579.kt", lineNumber = 10) +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at Test580Kt.main(test580.kt:10) test + +User code: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test580.Test580Kt", methodName = "main", fileName = "test580.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at Test581Kt.main(test581.kt:10) test + +User code: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test581.Test581Kt", methodName = "main", fileName = "test581.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at Test582Kt.main(test582.kt:10) test + +User code: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test582.Test582Kt", methodName = "main", fileName = "test582.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at Test583Kt.main(test583.kt:10) test + +User code: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test583.Test583Kt", methodName = "main", fileName = "test583.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at Test584Kt.main(test584.kt:10) test + +User code: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test584.Test584Kt", methodName = "main", fileName = "test584.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at Test585Kt.main(test585.kt:10) test + +User code: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test585.Test585Kt", methodName = "main", fileName = "test585.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test586Kt.main(test586.kt:10) test + +User code: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test586.Test586Kt", methodName = "main", fileName = "test586.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at Test587Kt.main(test587.kt:10) test + +User code: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test588Kt.main(test588.kt:10) test + +User code: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test589Kt.main(test589.kt:10) test + +User code: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at Test590Kt.main(test590.kt:10) test + +User code: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test590.Test590Kt", methodName = "main", fileName = "test590.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at Test591Kt.main(test591.kt:10) test + +User code: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test591.Test591Kt", methodName = "main", fileName = "test591.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at Test592Kt.main(test592.kt:10) test + +User code: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test592.Test592Kt", methodName = "main", fileName = "test592.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at Test593Kt.main(test593.kt:10) test + +User code: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test593.Test593Kt", methodName = "main", fileName = "test593.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at Test594Kt.main(test594.kt:10) test + +User code: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test594.Test594Kt", methodName = "main", fileName = "test594.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at Test595Kt.main(test595.kt:10) test + +User code: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test595.Test595Kt", methodName = "main", fileName = "test595.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at Test596Kt.main(test596.kt:10) test + +User code: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test596.Test596Kt", methodName = "main", fileName = "test596.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at Test597Kt.main(test597.kt:10) test + +User code: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test597.Test597Kt", methodName = "main", fileName = "test597.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at Test598Kt.main(test598.kt:10) test + +User code: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test598.Test598Kt", methodName = "main", fileName = "test598.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test599Kt.main(test599.kt:10) test + +User code: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test599.Test599Kt", methodName = "main", fileName = "test599.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at Test600Kt.main(test600.kt:10) test + +User code: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test600.Test600Kt", methodName = "main", fileName = "test600.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at Test601Kt.main(test601.kt:10) test + +User code: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test601.Test601Kt", methodName = "main", fileName = "test601.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test602Kt.main(test602.kt:10) test + +User code: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test602.Test602Kt", methodName = "main", fileName = "test602.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at Test603Kt.main(test603.kt:10) test + +User code: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test604Kt.main(test604.kt:10) test + +User code: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test605Kt.main(test605.kt:10) test + +User code: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### error("error message {}", throwable) at Test609Kt.main(test609.kt:10) test + +User code: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test609.Test609Kt", methodName = "main", fileName = "test609.kt", lineNumber = 10) +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at Test610Kt.main(test610.kt:10) test + +User code: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test610.Test610Kt", methodName = "main", fileName = "test610.kt", lineNumber = 10) +} +``` + +### error(throwable) { "error messageBuilder $i" } at Test611Kt.main(test611.kt:10) test + +User code: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test611.Test611Kt", methodName = "main", fileName = "test611.kt", lineNumber = 10) +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at Test612Kt.main(test612.kt:10) test + +User code: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test612.Test612Kt", methodName = "main", fileName = "test612.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=throwable } at Test613Kt.main(test613.kt:10) test + +User code: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test613.Test613Kt", methodName = "main", fileName = "test613.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at Test614Kt.main(test614.kt:10) test + +User code: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test614.Test614Kt", methodName = "main", fileName = "test614.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test615Kt.main(test615.kt:10) test + +User code: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test615.Test615Kt", methodName = "main", fileName = "test615.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at Test616Kt.main(test616.kt:10) test + +User code: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test616.Test616Kt", methodName = "main", fileName = "test616.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at Test617Kt.main(test617.kt:10) test + +User code: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test617.Test617Kt", methodName = "main", fileName = "test617.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test618Kt.main(test618.kt:10) test + +User code: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test618.Test618Kt", methodName = "main", fileName = "test618.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at Test619Kt.main(test619.kt:10) test + +User code: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test620Kt.main(test620.kt:10) test + +User code: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test621Kt.main(test621.kt:10) test + +User code: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at Test622Kt.main(test622.kt:10) test + +User code: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test622.Test622Kt", methodName = "main", fileName = "test622.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at Test623Kt.main(test623.kt:10) test + +User code: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test623.Test623Kt", methodName = "main", fileName = "test623.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at Test624Kt.main(test624.kt:10) test + +User code: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test624.Test624Kt", methodName = "main", fileName = "test624.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at Test625Kt.main(test625.kt:10) test + +User code: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test625.Test625Kt", methodName = "main", fileName = "test625.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at Test629Kt.main(test629.kt:10) test + +User code: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test629.Test629Kt", methodName = "main", fileName = "test629.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at Test630Kt.main(test630.kt:10) test + +User code: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test630.Test630Kt", methodName = "main", fileName = "test630.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test631Kt.main(test631.kt:10) test + +User code: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test631.Test631Kt", methodName = "main", fileName = "test631.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at Test632Kt.main(test632.kt:10) test + +User code: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test632.Test632Kt", methodName = "main", fileName = "test632.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at Test633Kt.main(test633.kt:10) test + +User code: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test633.Test633Kt", methodName = "main", fileName = "test633.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test634Kt.main(test634.kt:10) test + +User code: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test634.Test634Kt", methodName = "main", fileName = "test634.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at Test635Kt.main(test635.kt:10) test + +User code: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test636Kt.main(test636.kt:10) test + +User code: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test637Kt.main(test637.kt:10) test + +User code: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### error("error message {}") at Test641Kt.main(test641.kt:10) test + +User code: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") +} +``` + +Transformed into: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test641.Test641Kt", methodName = "main", fileName = "test641.kt", lineNumber = 10) +} +``` + +
+ +### error() { "error messageBuilder" } at Test642Kt.main(test642.kt:10) test + +User code: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test642.Test642Kt", methodName = "main", fileName = "test642.kt", lineNumber = 10) +} +``` + +### error() { "error messageBuilder $i" } at Test643Kt.main(test643.kt:10) test + +User code: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test643.Test643Kt", methodName = "main", fileName = "test643.kt", lineNumber = 10) +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at Test644Kt.main(test644.kt:10) test + +User code: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test644.Test644Kt", methodName = "main", fileName = "test644.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=null } at Test645Kt.main(test645.kt:10) test + +User code: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test645.Test645Kt", methodName = "main", fileName = "test645.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at Test646Kt.main(test646.kt:10) test + +User code: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test646.Test646Kt", methodName = "main", fileName = "test646.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at Test647Kt.main(test647.kt:10) test + +User code: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test647.Test647Kt", methodName = "main", fileName = "test647.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at Test648Kt.main(test648.kt:10) test + +User code: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test648.Test648Kt", methodName = "main", fileName = "test648.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at Test649Kt.main(test649.kt:10) test + +User code: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test649.Test649Kt", methodName = "main", fileName = "test649.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at Test650Kt.main(test650.kt:10) test + +User code: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test650.Test650Kt", methodName = "main", fileName = "test650.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
+ +
featureFlag=DISABLE_TRANSFORMING_DEPRECATED_API + +
with class=true + +
entry/exit API + +### entry(argument1, argument2) at MainTest.main(test1.kt:10) test + +User code: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) + } + +} +``` + +Transformed into: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entryWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "entry(argument1, argument2)", className = "test1.MainTest", methodName = "main", fileName = "test1.kt", lineNumber = 10)) + } + +} +``` + +### exit(resultValue) at MainTest.main(test2.kt:10) test + +User code: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) + } + +} +``` + +Transformed into: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "exit(resultValue)", className = "test2.MainTest", methodName = "main", fileName = "test2.kt", lineNumber = 10)) + } + +} +``` + +### exit() at MainTest.main(test3.kt:10) test + +User code: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() + } + +} +``` + +Transformed into: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(className = "test3.MainTest", methodName = "main", fileName = "test3.kt", lineNumber = 10)) + } + +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at MainTest.main(test4.kt:10) test + +User code: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) + } + +} +``` + +Transformed into: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "throwing(throwable)", className = "test4.MainTest", methodName = "main", fileName = "test4.kt", lineNumber = 10), throwable) + } + +} +``` + +### catching(throwable) at MainTest.main(test5.kt:10) test + +User code: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) + } + +} +``` + +Transformed into: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catchingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "catching(throwable)", className = "test5.MainTest", methodName = "main", fileName = "test5.kt", lineNumber = 10), throwable) + } + +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at MainTest.main(test6.kt:10) test + +User code: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test7.kt:10) test + +User code: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test8.kt:10) test + +User code: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at MainTest.main(test9.kt:10) test + +User code: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at MainTest.main(test10.kt:10) test + +User code: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test11.kt:10) test + +User code: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at MainTest.main(test12.kt:10) test + +User code: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at MainTest.main(test13.kt:10) test + +User code: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test13.MainTest", methodName = "main", fileName = "test13.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at MainTest.main(test14.kt:10) test + +User code: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test14.MainTest", methodName = "main", fileName = "test14.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test15.kt:10) test + +User code: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test15.MainTest", methodName = "main", fileName = "test15.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test16.kt:10) test + +User code: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test16.MainTest", methodName = "main", fileName = "test16.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test17.kt:10) test + +User code: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test17.MainTest", methodName = "main", fileName = "test17.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test18.kt:10) test + +User code: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test18.MainTest", methodName = "main", fileName = "test18.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test19.kt:10) test + +User code: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test19.MainTest", methodName = "main", fileName = "test19.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test20.kt:10) test + +User code: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test20.MainTest", methodName = "main", fileName = "test20.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test21.kt:10) test + +User code: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test21.MainTest", methodName = "main", fileName = "test21.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at MainTest.main(test22.kt:10) test + +User code: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test23.kt:10) test + +User code: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test24.kt:10) test + +User code: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}", throwable) at MainTest.main(test28.kt:10) test + +User code: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) + } + +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at MainTest.main(test29.kt:10) test + +User code: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test29.MainTest", methodName = "main", fileName = "test29.kt", lineNumber = 10) + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at MainTest.main(test30.kt:10) test + +User code: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test30.MainTest", methodName = "main", fileName = "test30.kt", lineNumber = 10) + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test31.kt:10) test + +User code: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test31.MainTest", methodName = "main", fileName = "test31.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at MainTest.main(test32.kt:10) test + +User code: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test32.MainTest", methodName = "main", fileName = "test32.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test33.kt:10) test + +User code: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test33.MainTest", methodName = "main", fileName = "test33.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test34.kt:10) test + +User code: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test34.MainTest", methodName = "main", fileName = "test34.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test35.kt:10) test + +User code: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test35.MainTest", methodName = "main", fileName = "test35.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test36.kt:10) test + +User code: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test36.MainTest", methodName = "main", fileName = "test36.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test37.kt:10) test + +User code: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test37.MainTest", methodName = "main", fileName = "test37.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at MainTest.main(test38.kt:10) test + +User code: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test39.kt:10) test + +User code: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test40.kt:10) test + +User code: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at MainTest.main(test41.kt:10) test + +User code: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at MainTest.main(test42.kt:10) test + +User code: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test43.kt:10) test + +User code: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at MainTest.main(test44.kt:10) test + +User code: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test48.kt:10) test + +User code: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test48.MainTest", methodName = "main", fileName = "test48.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test49.kt:10) test + +User code: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test49.MainTest", methodName = "main", fileName = "test49.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test50.kt:10) test + +User code: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test50.MainTest", methodName = "main", fileName = "test50.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test51.kt:10) test + +User code: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test51.MainTest", methodName = "main", fileName = "test51.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test52.kt:10) test + +User code: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test52.MainTest", methodName = "main", fileName = "test52.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test53.kt:10) test + +User code: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test53.MainTest", methodName = "main", fileName = "test53.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at MainTest.main(test54.kt:10) test + +User code: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test55.kt:10) test + +User code: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test56.kt:10) test + +User code: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}") at MainTest.main(test60.kt:10) test + +User code: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") + } + +} +``` + +Remains as-is: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") + } + +} +``` + +
+ +### trace() { "trace messageBuilder" } at MainTest.main(test61.kt:10) test + +User code: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test61.MainTest", methodName = "main", fileName = "test61.kt", lineNumber = 10) + } + +} +``` + +### trace() { "trace messageBuilder $i" } at MainTest.main(test62.kt:10) test + +User code: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test62.MainTest", methodName = "main", fileName = "test62.kt", lineNumber = 10) + } + +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at MainTest.main(test63.kt:10) test + +User code: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test63.MainTest", methodName = "main", fileName = "test63.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at MainTest.main(test64.kt:10) test + +User code: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test64.MainTest", methodName = "main", fileName = "test64.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at MainTest.main(test65.kt:10) test + +User code: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test65.MainTest", methodName = "main", fileName = "test65.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test66.kt:10) test + +User code: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test66.MainTest", methodName = "main", fileName = "test66.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at MainTest.main(test67.kt:10) test + +User code: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test67.MainTest", methodName = "main", fileName = "test67.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test68.kt:10) test + +User code: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test68.MainTest", methodName = "main", fileName = "test68.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test69.kt:10) test + +User code: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test69.MainTest", methodName = "main", fileName = "test69.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at MainTest.main(test70.kt:10) test + +User code: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test71.kt:10) test + +User code: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test72.kt:10) test + +User code: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at MainTest.main(test73.kt:10) test + +User code: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at MainTest.main(test74.kt:10) test + +User code: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test75.kt:10) test + +User code: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at MainTest.main(test76.kt:10) test + +User code: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at MainTest.main(test77.kt:10) test + +User code: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test77.MainTest", methodName = "main", fileName = "test77.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at MainTest.main(test78.kt:10) test + +User code: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test78.MainTest", methodName = "main", fileName = "test78.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test79.kt:10) test + +User code: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test79.MainTest", methodName = "main", fileName = "test79.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test80.kt:10) test + +User code: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test80.MainTest", methodName = "main", fileName = "test80.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test81.kt:10) test + +User code: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test81.MainTest", methodName = "main", fileName = "test81.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test82.kt:10) test + +User code: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test82.MainTest", methodName = "main", fileName = "test82.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test83.kt:10) test + +User code: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test83.MainTest", methodName = "main", fileName = "test83.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test84.kt:10) test + +User code: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test84.MainTest", methodName = "main", fileName = "test84.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test85.kt:10) test + +User code: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test85.MainTest", methodName = "main", fileName = "test85.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at MainTest.main(test86.kt:10) test + +User code: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test87.kt:10) test + +User code: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test88.kt:10) test + +User code: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}", throwable) at MainTest.main(test92.kt:10) test + +User code: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) + } + +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at MainTest.main(test93.kt:10) test + +User code: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test93.MainTest", methodName = "main", fileName = "test93.kt", lineNumber = 10) + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at MainTest.main(test94.kt:10) test + +User code: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test94.MainTest", methodName = "main", fileName = "test94.kt", lineNumber = 10) + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test95.kt:10) test + +User code: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test95.MainTest", methodName = "main", fileName = "test95.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at MainTest.main(test96.kt:10) test + +User code: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test96.MainTest", methodName = "main", fileName = "test96.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test97.kt:10) test + +User code: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test97.MainTest", methodName = "main", fileName = "test97.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test98.kt:10) test + +User code: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test98.MainTest", methodName = "main", fileName = "test98.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test99.kt:10) test + +User code: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test99.MainTest", methodName = "main", fileName = "test99.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test100.kt:10) test + +User code: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test100.MainTest", methodName = "main", fileName = "test100.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test101.kt:10) test + +User code: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test101.MainTest", methodName = "main", fileName = "test101.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at MainTest.main(test102.kt:10) test + +User code: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test103.kt:10) test + +User code: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test104.kt:10) test + +User code: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at MainTest.main(test105.kt:10) test + +User code: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at MainTest.main(test106.kt:10) test + +User code: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test107.kt:10) test + +User code: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at MainTest.main(test108.kt:10) test + +User code: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test112.kt:10) test + +User code: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test112.MainTest", methodName = "main", fileName = "test112.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test113.kt:10) test + +User code: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test113.MainTest", methodName = "main", fileName = "test113.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test114.kt:10) test + +User code: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test114.MainTest", methodName = "main", fileName = "test114.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test115.kt:10) test + +User code: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test115.MainTest", methodName = "main", fileName = "test115.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test116.kt:10) test + +User code: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test116.MainTest", methodName = "main", fileName = "test116.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test117.kt:10) test + +User code: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test117.MainTest", methodName = "main", fileName = "test117.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at MainTest.main(test118.kt:10) test + +User code: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test119.kt:10) test + +User code: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test120.kt:10) test + +User code: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}") at MainTest.main(test124.kt:10) test + +User code: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") + } + +} +``` + +Remains as-is: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") + } + +} +``` + +
+ +### debug() { "debug messageBuilder" } at MainTest.main(test125.kt:10) test + +User code: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test125.MainTest", methodName = "main", fileName = "test125.kt", lineNumber = 10) + } + +} +``` + +### debug() { "debug messageBuilder $i" } at MainTest.main(test126.kt:10) test + +User code: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test126.MainTest", methodName = "main", fileName = "test126.kt", lineNumber = 10) + } + +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at MainTest.main(test127.kt:10) test + +User code: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test127.MainTest", methodName = "main", fileName = "test127.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at MainTest.main(test128.kt:10) test + +User code: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test128.MainTest", methodName = "main", fileName = "test128.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at MainTest.main(test129.kt:10) test + +User code: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test129.MainTest", methodName = "main", fileName = "test129.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test130.kt:10) test + +User code: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test130.MainTest", methodName = "main", fileName = "test130.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at MainTest.main(test131.kt:10) test + +User code: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test131.MainTest", methodName = "main", fileName = "test131.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test132.kt:10) test + +User code: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test132.MainTest", methodName = "main", fileName = "test132.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test133.kt:10) test + +User code: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test133.MainTest", methodName = "main", fileName = "test133.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at MainTest.main(test134.kt:10) test + +User code: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test135.kt:10) test + +User code: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test136.kt:10) test + +User code: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at MainTest.main(test137.kt:10) test + +User code: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at MainTest.main(test138.kt:10) test + +User code: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test139.kt:10) test + +User code: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at MainTest.main(test140.kt:10) test + +User code: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at MainTest.main(test141.kt:10) test + +User code: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test141.MainTest", methodName = "main", fileName = "test141.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at MainTest.main(test142.kt:10) test + +User code: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test142.MainTest", methodName = "main", fileName = "test142.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test143.kt:10) test + +User code: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test143.MainTest", methodName = "main", fileName = "test143.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test144.kt:10) test + +User code: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test144.MainTest", methodName = "main", fileName = "test144.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test145.kt:10) test + +User code: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test145.MainTest", methodName = "main", fileName = "test145.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test146.kt:10) test + +User code: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test146.MainTest", methodName = "main", fileName = "test146.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test147.kt:10) test + +User code: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test147.MainTest", methodName = "main", fileName = "test147.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test148.kt:10) test + +User code: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test148.MainTest", methodName = "main", fileName = "test148.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test149.kt:10) test + +User code: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test149.MainTest", methodName = "main", fileName = "test149.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at MainTest.main(test150.kt:10) test + +User code: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test151.kt:10) test + +User code: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test152.kt:10) test + +User code: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}", throwable) at MainTest.main(test156.kt:10) test + +User code: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) + } + +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at MainTest.main(test157.kt:10) test + +User code: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test157.MainTest", methodName = "main", fileName = "test157.kt", lineNumber = 10) + } + +} +``` + +### info(throwable) { "info messageBuilder $i" } at MainTest.main(test158.kt:10) test + +User code: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test158.MainTest", methodName = "main", fileName = "test158.kt", lineNumber = 10) + } + +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test159.kt:10) test + +User code: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test159.MainTest", methodName = "main", fileName = "test159.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at MainTest.main(test160.kt:10) test + +User code: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test160.MainTest", methodName = "main", fileName = "test160.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test161.kt:10) test + +User code: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test161.MainTest", methodName = "main", fileName = "test161.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test162.kt:10) test + +User code: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test162.MainTest", methodName = "main", fileName = "test162.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at MainTest.main(test163.kt:10) test + +User code: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test163.MainTest", methodName = "main", fileName = "test163.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test164.kt:10) test + +User code: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test164.MainTest", methodName = "main", fileName = "test164.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test165.kt:10) test + +User code: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test165.MainTest", methodName = "main", fileName = "test165.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at MainTest.main(test166.kt:10) test + +User code: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test167.kt:10) test + +User code: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test168.kt:10) test + +User code: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at MainTest.main(test169.kt:10) test + +User code: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at MainTest.main(test170.kt:10) test + +User code: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test171.kt:10) test + +User code: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at MainTest.main(test172.kt:10) test + +User code: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at MainTest.main(test176.kt:10) test + +User code: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test176.MainTest", methodName = "main", fileName = "test176.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test177.kt:10) test + +User code: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test177.MainTest", methodName = "main", fileName = "test177.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test178.kt:10) test + +User code: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test178.MainTest", methodName = "main", fileName = "test178.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at MainTest.main(test179.kt:10) test + +User code: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test179.MainTest", methodName = "main", fileName = "test179.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test180.kt:10) test + +User code: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test180.MainTest", methodName = "main", fileName = "test180.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test181.kt:10) test + +User code: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test181.MainTest", methodName = "main", fileName = "test181.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at MainTest.main(test182.kt:10) test + +User code: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test183.kt:10) test + +User code: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test184.kt:10) test + +User code: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}") at MainTest.main(test188.kt:10) test + +User code: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") + } + +} +``` + +Remains as-is: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") + } + +} +``` + +
+ +### info() { "info messageBuilder" } at MainTest.main(test189.kt:10) test + +User code: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test189.MainTest", methodName = "main", fileName = "test189.kt", lineNumber = 10) + } + +} +``` + +### info() { "info messageBuilder $i" } at MainTest.main(test190.kt:10) test + +User code: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test190.MainTest", methodName = "main", fileName = "test190.kt", lineNumber = 10) + } + +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at MainTest.main(test191.kt:10) test + +User code: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test191.MainTest", methodName = "main", fileName = "test191.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=null } at MainTest.main(test192.kt:10) test + +User code: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test192.MainTest", methodName = "main", fileName = "test192.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at MainTest.main(test193.kt:10) test + +User code: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test193.MainTest", methodName = "main", fileName = "test193.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test194.kt:10) test + +User code: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test194.MainTest", methodName = "main", fileName = "test194.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at MainTest.main(test195.kt:10) test + +User code: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test195.MainTest", methodName = "main", fileName = "test195.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at MainTest.main(test196.kt:10) test + +User code: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test196.MainTest", methodName = "main", fileName = "test196.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test197.kt:10) test + +User code: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test197.MainTest", methodName = "main", fileName = "test197.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at MainTest.main(test198.kt:10) test + +User code: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test199.kt:10) test + +User code: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test200.kt:10) test + +User code: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at MainTest.main(test201.kt:10) test + +User code: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at MainTest.main(test202.kt:10) test + +User code: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test203.kt:10) test + +User code: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at MainTest.main(test204.kt:10) test + +User code: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at MainTest.main(test205.kt:10) test + +User code: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test205.MainTest", methodName = "main", fileName = "test205.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at MainTest.main(test206.kt:10) test + +User code: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test206.MainTest", methodName = "main", fileName = "test206.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test207.kt:10) test + +User code: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test207.MainTest", methodName = "main", fileName = "test207.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test208.kt:10) test + +User code: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test208.MainTest", methodName = "main", fileName = "test208.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test209.kt:10) test + +User code: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test209.MainTest", methodName = "main", fileName = "test209.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test210.kt:10) test + +User code: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test210.MainTest", methodName = "main", fileName = "test210.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test211.kt:10) test + +User code: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test211.MainTest", methodName = "main", fileName = "test211.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test212.kt:10) test + +User code: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test212.MainTest", methodName = "main", fileName = "test212.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test213.kt:10) test + +User code: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test213.MainTest", methodName = "main", fileName = "test213.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at MainTest.main(test214.kt:10) test + +User code: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test215.kt:10) test + +User code: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test216.kt:10) test + +User code: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}", throwable) at MainTest.main(test220.kt:10) test + +User code: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) + } + +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at MainTest.main(test221.kt:10) test + +User code: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test221.MainTest", methodName = "main", fileName = "test221.kt", lineNumber = 10) + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at MainTest.main(test222.kt:10) test + +User code: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test222.MainTest", methodName = "main", fileName = "test222.kt", lineNumber = 10) + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test223.kt:10) test + +User code: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test223.MainTest", methodName = "main", fileName = "test223.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at MainTest.main(test224.kt:10) test + +User code: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test224.MainTest", methodName = "main", fileName = "test224.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test225.kt:10) test + +User code: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test225.MainTest", methodName = "main", fileName = "test225.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test226.kt:10) test + +User code: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test226.MainTest", methodName = "main", fileName = "test226.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test227.kt:10) test + +User code: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test227.MainTest", methodName = "main", fileName = "test227.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test228.kt:10) test + +User code: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test228.MainTest", methodName = "main", fileName = "test228.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test229.kt:10) test + +User code: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test229.MainTest", methodName = "main", fileName = "test229.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at MainTest.main(test230.kt:10) test + +User code: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test231.kt:10) test + +User code: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test232.kt:10) test + +User code: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at MainTest.main(test233.kt:10) test + +User code: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at MainTest.main(test234.kt:10) test + +User code: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test235.kt:10) test + +User code: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at MainTest.main(test236.kt:10) test + +User code: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test240.kt:10) test + +User code: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test240.MainTest", methodName = "main", fileName = "test240.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test241.kt:10) test + +User code: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test241.MainTest", methodName = "main", fileName = "test241.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test242.kt:10) test + +User code: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test242.MainTest", methodName = "main", fileName = "test242.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test243.kt:10) test + +User code: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test243.MainTest", methodName = "main", fileName = "test243.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test244.kt:10) test + +User code: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test244.MainTest", methodName = "main", fileName = "test244.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test245.kt:10) test + +User code: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test245.MainTest", methodName = "main", fileName = "test245.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at MainTest.main(test246.kt:10) test + +User code: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test247.kt:10) test + +User code: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test248.kt:10) test + +User code: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}") at MainTest.main(test252.kt:10) test + +User code: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") + } + +} +``` + +Remains as-is: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") + } + +} +``` + +
+ +### warn() { "warn messageBuilder" } at MainTest.main(test253.kt:10) test + +User code: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test253.MainTest", methodName = "main", fileName = "test253.kt", lineNumber = 10) + } + +} +``` + +### warn() { "warn messageBuilder $i" } at MainTest.main(test254.kt:10) test + +User code: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test254.MainTest", methodName = "main", fileName = "test254.kt", lineNumber = 10) + } + +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at MainTest.main(test255.kt:10) test + +User code: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test255.MainTest", methodName = "main", fileName = "test255.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at MainTest.main(test256.kt:10) test + +User code: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test256.MainTest", methodName = "main", fileName = "test256.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at MainTest.main(test257.kt:10) test + +User code: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test257.MainTest", methodName = "main", fileName = "test257.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test258.kt:10) test + +User code: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test258.MainTest", methodName = "main", fileName = "test258.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at MainTest.main(test259.kt:10) test + +User code: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test259.MainTest", methodName = "main", fileName = "test259.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test260.kt:10) test + +User code: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test260.MainTest", methodName = "main", fileName = "test260.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test261.kt:10) test + +User code: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test261.MainTest", methodName = "main", fileName = "test261.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at MainTest.main(test262.kt:10) test + +User code: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test263.kt:10) test + +User code: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test264.kt:10) test + +User code: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at MainTest.main(test265.kt:10) test + +User code: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at MainTest.main(test266.kt:10) test + +User code: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test267.kt:10) test + +User code: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at MainTest.main(test268.kt:10) test + +User code: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at MainTest.main(test269.kt:10) test + +User code: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test269.MainTest", methodName = "main", fileName = "test269.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at MainTest.main(test270.kt:10) test + +User code: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test270.MainTest", methodName = "main", fileName = "test270.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test271.kt:10) test + +User code: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test271.MainTest", methodName = "main", fileName = "test271.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test272.kt:10) test + +User code: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test272.MainTest", methodName = "main", fileName = "test272.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test273.kt:10) test + +User code: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test273.MainTest", methodName = "main", fileName = "test273.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test274.kt:10) test + +User code: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test274.MainTest", methodName = "main", fileName = "test274.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test275.kt:10) test + +User code: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test275.MainTest", methodName = "main", fileName = "test275.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test276.kt:10) test + +User code: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test276.MainTest", methodName = "main", fileName = "test276.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test277.kt:10) test + +User code: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test277.MainTest", methodName = "main", fileName = "test277.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at MainTest.main(test278.kt:10) test + +User code: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test279.kt:10) test + +User code: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test280.kt:10) test + +User code: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}", throwable) at MainTest.main(test284.kt:10) test + +User code: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) + } + +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at MainTest.main(test285.kt:10) test + +User code: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test285.MainTest", methodName = "main", fileName = "test285.kt", lineNumber = 10) + } + +} +``` + +### error(throwable) { "error messageBuilder $i" } at MainTest.main(test286.kt:10) test + +User code: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test286.MainTest", methodName = "main", fileName = "test286.kt", lineNumber = 10) + } + +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test287.kt:10) test + +User code: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test287.MainTest", methodName = "main", fileName = "test287.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=throwable } at MainTest.main(test288.kt:10) test + +User code: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test288.MainTest", methodName = "main", fileName = "test288.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test289.kt:10) test + +User code: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test289.MainTest", methodName = "main", fileName = "test289.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test290.kt:10) test + +User code: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test290.MainTest", methodName = "main", fileName = "test290.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at MainTest.main(test291.kt:10) test + +User code: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test291.MainTest", methodName = "main", fileName = "test291.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test292.kt:10) test + +User code: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test292.MainTest", methodName = "main", fileName = "test292.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test293.kt:10) test + +User code: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test293.MainTest", methodName = "main", fileName = "test293.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at MainTest.main(test294.kt:10) test + +User code: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test295.kt:10) test + +User code: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test296.kt:10) test + +User code: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at MainTest.main(test297.kt:10) test + +User code: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at MainTest.main(test298.kt:10) test + +User code: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test299.kt:10) test + +User code: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at MainTest.main(test300.kt:10) test + +User code: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at MainTest.main(test304.kt:10) test + +User code: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test304.MainTest", methodName = "main", fileName = "test304.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test305.kt:10) test + +User code: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test305.MainTest", methodName = "main", fileName = "test305.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test306.kt:10) test + +User code: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test306.MainTest", methodName = "main", fileName = "test306.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at MainTest.main(test307.kt:10) test + +User code: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test307.MainTest", methodName = "main", fileName = "test307.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test308.kt:10) test + +User code: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test308.MainTest", methodName = "main", fileName = "test308.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test309.kt:10) test + +User code: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test309.MainTest", methodName = "main", fileName = "test309.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at MainTest.main(test310.kt:10) test + +User code: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test311.kt:10) test + +User code: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test312.kt:10) test + +User code: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}") at MainTest.main(test316.kt:10) test + +User code: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") + } + +} +``` + +Remains as-is: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") + } + +} +``` + +
+ +### error() { "error messageBuilder" } at MainTest.main(test317.kt:10) test + +User code: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test317.MainTest", methodName = "main", fileName = "test317.kt", lineNumber = 10) + } + +} +``` + +### error() { "error messageBuilder $i" } at MainTest.main(test318.kt:10) test + +User code: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test318.MainTest", methodName = "main", fileName = "test318.kt", lineNumber = 10) + } + +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at MainTest.main(test319.kt:10) test + +User code: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test319.MainTest", methodName = "main", fileName = "test319.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=null } at MainTest.main(test320.kt:10) test + +User code: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test320.MainTest", methodName = "main", fileName = "test320.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at MainTest.main(test321.kt:10) test + +User code: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test321.MainTest", methodName = "main", fileName = "test321.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test322.kt:10) test + +User code: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test322.MainTest", methodName = "main", fileName = "test322.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at MainTest.main(test323.kt:10) test + +User code: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test323.MainTest", methodName = "main", fileName = "test323.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at MainTest.main(test324.kt:10) test + +User code: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test324.MainTest", methodName = "main", fileName = "test324.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test325.kt:10) test + +User code: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test325.MainTest", methodName = "main", fileName = "test325.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
+ +
with class=false + +
entry/exit API + +### entry(argument1, argument2) at Test326Kt.main(test326.kt:10) test + +User code: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) +} +``` + +Transformed into: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entryWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "entry(argument1, argument2)", className = "test326.Test326Kt", methodName = "main", fileName = "test326.kt", lineNumber = 10)) +} +``` + +### exit(resultValue) at Test327Kt.main(test327.kt:10) test + +User code: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) +} +``` + +Transformed into: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "exit(resultValue)", className = "test327.Test327Kt", methodName = "main", fileName = "test327.kt", lineNumber = 10)) +} +``` + +### exit() at Test328Kt.main(test328.kt:10) test + +User code: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() +} +``` + +Transformed into: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(className = "test328.Test328Kt", methodName = "main", fileName = "test328.kt", lineNumber = 10)) +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at Test329Kt.main(test329.kt:10) test + +User code: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) +} +``` + +Transformed into: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "throwing(throwable)", className = "test329.Test329Kt", methodName = "main", fileName = "test329.kt", lineNumber = 10), throwable) +} +``` + +### catching(throwable) at Test330Kt.main(test330.kt:10) test + +User code: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) +} +``` + +Transformed into: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catchingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "catching(throwable)", className = "test330.Test330Kt", methodName = "main", fileName = "test330.kt", lineNumber = 10), throwable) +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at Test331Kt.main(test331.kt:10) test + +User code: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test332Kt.main(test332.kt:10) test + +User code: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test333Kt.main(test333.kt:10) test + +User code: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at Test334Kt.main(test334.kt:10) test + +User code: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at Test335Kt.main(test335.kt:10) test + +User code: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at Test336Kt.main(test336.kt:10) test + +User code: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at Test337Kt.main(test337.kt:10) test + +User code: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at Test338Kt.main(test338.kt:10) test + +User code: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test338.Test338Kt", methodName = "main", fileName = "test338.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at Test339Kt.main(test339.kt:10) test + +User code: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test339.Test339Kt", methodName = "main", fileName = "test339.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at Test340Kt.main(test340.kt:10) test + +User code: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test340.Test340Kt", methodName = "main", fileName = "test340.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at Test341Kt.main(test341.kt:10) test + +User code: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test341.Test341Kt", methodName = "main", fileName = "test341.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at Test342Kt.main(test342.kt:10) test + +User code: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test342.Test342Kt", methodName = "main", fileName = "test342.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test343Kt.main(test343.kt:10) test + +User code: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test343.Test343Kt", methodName = "main", fileName = "test343.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at Test344Kt.main(test344.kt:10) test + +User code: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test344.Test344Kt", methodName = "main", fileName = "test344.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at Test345Kt.main(test345.kt:10) test + +User code: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test345.Test345Kt", methodName = "main", fileName = "test345.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test346Kt.main(test346.kt:10) test + +User code: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test346.Test346Kt", methodName = "main", fileName = "test346.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at Test347Kt.main(test347.kt:10) test + +User code: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test348Kt.main(test348.kt:10) test + +User code: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test349Kt.main(test349.kt:10) test + +User code: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}", throwable) at Test353Kt.main(test353.kt:10) test + +User code: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) +} +``` + +Remains as-is: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at Test354Kt.main(test354.kt:10) test + +User code: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test354.Test354Kt", methodName = "main", fileName = "test354.kt", lineNumber = 10) +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at Test355Kt.main(test355.kt:10) test + +User code: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test355.Test355Kt", methodName = "main", fileName = "test355.kt", lineNumber = 10) +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at Test356Kt.main(test356.kt:10) test + +User code: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test356.Test356Kt", methodName = "main", fileName = "test356.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at Test357Kt.main(test357.kt:10) test + +User code: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test357.Test357Kt", methodName = "main", fileName = "test357.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at Test358Kt.main(test358.kt:10) test + +User code: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test358.Test358Kt", methodName = "main", fileName = "test358.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test359Kt.main(test359.kt:10) test + +User code: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test359.Test359Kt", methodName = "main", fileName = "test359.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at Test360Kt.main(test360.kt:10) test + +User code: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test360.Test360Kt", methodName = "main", fileName = "test360.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at Test361Kt.main(test361.kt:10) test + +User code: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test361.Test361Kt", methodName = "main", fileName = "test361.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test362Kt.main(test362.kt:10) test + +User code: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test362.Test362Kt", methodName = "main", fileName = "test362.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at Test363Kt.main(test363.kt:10) test + +User code: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test364Kt.main(test364.kt:10) test + +User code: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test365Kt.main(test365.kt:10) test + +User code: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at Test366Kt.main(test366.kt:10) test + +User code: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at Test367Kt.main(test367.kt:10) test + +User code: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at Test368Kt.main(test368.kt:10) test + +User code: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at Test369Kt.main(test369.kt:10) test + +User code: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at Test373Kt.main(test373.kt:10) test + +User code: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test373.Test373Kt", methodName = "main", fileName = "test373.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at Test374Kt.main(test374.kt:10) test + +User code: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test374.Test374Kt", methodName = "main", fileName = "test374.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test375Kt.main(test375.kt:10) test + +User code: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test375.Test375Kt", methodName = "main", fileName = "test375.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at Test376Kt.main(test376.kt:10) test + +User code: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test376.Test376Kt", methodName = "main", fileName = "test376.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at Test377Kt.main(test377.kt:10) test + +User code: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test377.Test377Kt", methodName = "main", fileName = "test377.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test378Kt.main(test378.kt:10) test + +User code: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test378.Test378Kt", methodName = "main", fileName = "test378.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at Test379Kt.main(test379.kt:10) test + +User code: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test380Kt.main(test380.kt:10) test + +User code: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test381Kt.main(test381.kt:10) test + +User code: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}") at Test385Kt.main(test385.kt:10) test + +User code: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") +} +``` + +Remains as-is: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") +} +``` + +
+ +### trace() { "trace messageBuilder" } at Test386Kt.main(test386.kt:10) test + +User code: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test386.Test386Kt", methodName = "main", fileName = "test386.kt", lineNumber = 10) +} +``` + +### trace() { "trace messageBuilder $i" } at Test387Kt.main(test387.kt:10) test + +User code: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test387.Test387Kt", methodName = "main", fileName = "test387.kt", lineNumber = 10) +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at Test388Kt.main(test388.kt:10) test + +User code: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test388.Test388Kt", methodName = "main", fileName = "test388.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at Test389Kt.main(test389.kt:10) test + +User code: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test389.Test389Kt", methodName = "main", fileName = "test389.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at Test390Kt.main(test390.kt:10) test + +User code: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test390.Test390Kt", methodName = "main", fileName = "test390.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at Test391Kt.main(test391.kt:10) test + +User code: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test391.Test391Kt", methodName = "main", fileName = "test391.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at Test392Kt.main(test392.kt:10) test + +User code: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test392.Test392Kt", methodName = "main", fileName = "test392.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at Test393Kt.main(test393.kt:10) test + +User code: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test393.Test393Kt", methodName = "main", fileName = "test393.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test394Kt.main(test394.kt:10) test + +User code: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test394.Test394Kt", methodName = "main", fileName = "test394.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at Test395Kt.main(test395.kt:10) test + +User code: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test396Kt.main(test396.kt:10) test + +User code: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test397Kt.main(test397.kt:10) test + +User code: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at Test398Kt.main(test398.kt:10) test + +User code: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at Test399Kt.main(test399.kt:10) test + +User code: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at Test400Kt.main(test400.kt:10) test + +User code: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at Test401Kt.main(test401.kt:10) test + +User code: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at Test402Kt.main(test402.kt:10) test + +User code: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test402.Test402Kt", methodName = "main", fileName = "test402.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at Test403Kt.main(test403.kt:10) test + +User code: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test403.Test403Kt", methodName = "main", fileName = "test403.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at Test404Kt.main(test404.kt:10) test + +User code: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test404.Test404Kt", methodName = "main", fileName = "test404.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at Test405Kt.main(test405.kt:10) test + +User code: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test405.Test405Kt", methodName = "main", fileName = "test405.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at Test406Kt.main(test406.kt:10) test + +User code: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test406.Test406Kt", methodName = "main", fileName = "test406.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test407Kt.main(test407.kt:10) test + +User code: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test407.Test407Kt", methodName = "main", fileName = "test407.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at Test408Kt.main(test408.kt:10) test + +User code: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test408.Test408Kt", methodName = "main", fileName = "test408.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at Test409Kt.main(test409.kt:10) test + +User code: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test409.Test409Kt", methodName = "main", fileName = "test409.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test410Kt.main(test410.kt:10) test + +User code: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test410.Test410Kt", methodName = "main", fileName = "test410.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at Test411Kt.main(test411.kt:10) test + +User code: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test412Kt.main(test412.kt:10) test + +User code: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test413Kt.main(test413.kt:10) test + +User code: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}", throwable) at Test417Kt.main(test417.kt:10) test + +User code: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) +} +``` + +Remains as-is: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at Test418Kt.main(test418.kt:10) test + +User code: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test418.Test418Kt", methodName = "main", fileName = "test418.kt", lineNumber = 10) +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at Test419Kt.main(test419.kt:10) test + +User code: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test419.Test419Kt", methodName = "main", fileName = "test419.kt", lineNumber = 10) +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at Test420Kt.main(test420.kt:10) test + +User code: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test420.Test420Kt", methodName = "main", fileName = "test420.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at Test421Kt.main(test421.kt:10) test + +User code: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test421.Test421Kt", methodName = "main", fileName = "test421.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at Test422Kt.main(test422.kt:10) test + +User code: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test422.Test422Kt", methodName = "main", fileName = "test422.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test423Kt.main(test423.kt:10) test + +User code: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test423.Test423Kt", methodName = "main", fileName = "test423.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at Test424Kt.main(test424.kt:10) test + +User code: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test424.Test424Kt", methodName = "main", fileName = "test424.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at Test425Kt.main(test425.kt:10) test + +User code: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test425.Test425Kt", methodName = "main", fileName = "test425.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test426Kt.main(test426.kt:10) test + +User code: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test426.Test426Kt", methodName = "main", fileName = "test426.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at Test427Kt.main(test427.kt:10) test + +User code: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test428Kt.main(test428.kt:10) test + +User code: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test429Kt.main(test429.kt:10) test + +User code: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at Test430Kt.main(test430.kt:10) test + +User code: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at Test431Kt.main(test431.kt:10) test + +User code: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at Test432Kt.main(test432.kt:10) test + +User code: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at Test433Kt.main(test433.kt:10) test + +User code: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at Test437Kt.main(test437.kt:10) test + +User code: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test437.Test437Kt", methodName = "main", fileName = "test437.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at Test438Kt.main(test438.kt:10) test + +User code: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test438.Test438Kt", methodName = "main", fileName = "test438.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test439Kt.main(test439.kt:10) test + +User code: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test439.Test439Kt", methodName = "main", fileName = "test439.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at Test440Kt.main(test440.kt:10) test + +User code: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test440.Test440Kt", methodName = "main", fileName = "test440.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at Test441Kt.main(test441.kt:10) test + +User code: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test441.Test441Kt", methodName = "main", fileName = "test441.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test442Kt.main(test442.kt:10) test + +User code: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test442.Test442Kt", methodName = "main", fileName = "test442.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at Test443Kt.main(test443.kt:10) test + +User code: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test444Kt.main(test444.kt:10) test + +User code: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test445Kt.main(test445.kt:10) test + +User code: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}") at Test449Kt.main(test449.kt:10) test + +User code: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") +} +``` + +Remains as-is: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") +} +``` + +
+ +### debug() { "debug messageBuilder" } at Test450Kt.main(test450.kt:10) test + +User code: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test450.Test450Kt", methodName = "main", fileName = "test450.kt", lineNumber = 10) +} +``` + +### debug() { "debug messageBuilder $i" } at Test451Kt.main(test451.kt:10) test + +User code: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test451.Test451Kt", methodName = "main", fileName = "test451.kt", lineNumber = 10) +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at Test452Kt.main(test452.kt:10) test + +User code: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test452.Test452Kt", methodName = "main", fileName = "test452.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at Test453Kt.main(test453.kt:10) test + +User code: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test453.Test453Kt", methodName = "main", fileName = "test453.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at Test454Kt.main(test454.kt:10) test + +User code: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test454.Test454Kt", methodName = "main", fileName = "test454.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at Test455Kt.main(test455.kt:10) test + +User code: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test455.Test455Kt", methodName = "main", fileName = "test455.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at Test456Kt.main(test456.kt:10) test + +User code: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test456.Test456Kt", methodName = "main", fileName = "test456.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at Test457Kt.main(test457.kt:10) test + +User code: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test457.Test457Kt", methodName = "main", fileName = "test457.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test458Kt.main(test458.kt:10) test + +User code: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test458.Test458Kt", methodName = "main", fileName = "test458.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at Test459Kt.main(test459.kt:10) test + +User code: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test460Kt.main(test460.kt:10) test + +User code: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test461Kt.main(test461.kt:10) test + +User code: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at Test462Kt.main(test462.kt:10) test + +User code: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at Test463Kt.main(test463.kt:10) test + +User code: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at Test464Kt.main(test464.kt:10) test + +User code: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at Test465Kt.main(test465.kt:10) test + +User code: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at Test466Kt.main(test466.kt:10) test + +User code: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test466.Test466Kt", methodName = "main", fileName = "test466.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at Test467Kt.main(test467.kt:10) test + +User code: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test467.Test467Kt", methodName = "main", fileName = "test467.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at Test468Kt.main(test468.kt:10) test + +User code: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test468.Test468Kt", methodName = "main", fileName = "test468.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at Test469Kt.main(test469.kt:10) test + +User code: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test469.Test469Kt", methodName = "main", fileName = "test469.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at Test470Kt.main(test470.kt:10) test + +User code: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test470.Test470Kt", methodName = "main", fileName = "test470.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test471Kt.main(test471.kt:10) test + +User code: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test471.Test471Kt", methodName = "main", fileName = "test471.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at Test472Kt.main(test472.kt:10) test + +User code: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test472.Test472Kt", methodName = "main", fileName = "test472.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at Test473Kt.main(test473.kt:10) test + +User code: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test473.Test473Kt", methodName = "main", fileName = "test473.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test474Kt.main(test474.kt:10) test + +User code: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test474.Test474Kt", methodName = "main", fileName = "test474.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at Test475Kt.main(test475.kt:10) test + +User code: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test476Kt.main(test476.kt:10) test + +User code: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test477Kt.main(test477.kt:10) test + +User code: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### info("info message {}", throwable) at Test481Kt.main(test481.kt:10) test + +User code: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) +} +``` + +Remains as-is: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at Test482Kt.main(test482.kt:10) test + +User code: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test482.Test482Kt", methodName = "main", fileName = "test482.kt", lineNumber = 10) +} +``` + +### info(throwable) { "info messageBuilder $i" } at Test483Kt.main(test483.kt:10) test + +User code: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test483.Test483Kt", methodName = "main", fileName = "test483.kt", lineNumber = 10) +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at Test484Kt.main(test484.kt:10) test + +User code: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test484.Test484Kt", methodName = "main", fileName = "test484.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at Test485Kt.main(test485.kt:10) test + +User code: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test485.Test485Kt", methodName = "main", fileName = "test485.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at Test486Kt.main(test486.kt:10) test + +User code: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test486.Test486Kt", methodName = "main", fileName = "test486.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test487Kt.main(test487.kt:10) test + +User code: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test487.Test487Kt", methodName = "main", fileName = "test487.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at Test488Kt.main(test488.kt:10) test + +User code: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test488.Test488Kt", methodName = "main", fileName = "test488.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at Test489Kt.main(test489.kt:10) test + +User code: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test489.Test489Kt", methodName = "main", fileName = "test489.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test490Kt.main(test490.kt:10) test + +User code: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test490.Test490Kt", methodName = "main", fileName = "test490.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at Test491Kt.main(test491.kt:10) test + +User code: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test492Kt.main(test492.kt:10) test + +User code: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test493Kt.main(test493.kt:10) test + +User code: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at Test494Kt.main(test494.kt:10) test + +User code: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at Test495Kt.main(test495.kt:10) test + +User code: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at Test496Kt.main(test496.kt:10) test + +User code: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at Test497Kt.main(test497.kt:10) test + +User code: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at Test501Kt.main(test501.kt:10) test + +User code: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test501.Test501Kt", methodName = "main", fileName = "test501.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at Test502Kt.main(test502.kt:10) test + +User code: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test502.Test502Kt", methodName = "main", fileName = "test502.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test503Kt.main(test503.kt:10) test + +User code: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test503.Test503Kt", methodName = "main", fileName = "test503.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at Test504Kt.main(test504.kt:10) test + +User code: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test504.Test504Kt", methodName = "main", fileName = "test504.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at Test505Kt.main(test505.kt:10) test + +User code: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test505.Test505Kt", methodName = "main", fileName = "test505.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test506Kt.main(test506.kt:10) test + +User code: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test506.Test506Kt", methodName = "main", fileName = "test506.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at Test507Kt.main(test507.kt:10) test + +User code: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test508Kt.main(test508.kt:10) test + +User code: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test509Kt.main(test509.kt:10) test + +User code: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### info("info message {}") at Test513Kt.main(test513.kt:10) test + +User code: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") +} +``` + +Remains as-is: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") +} +``` + +
+ +### info() { "info messageBuilder" } at Test514Kt.main(test514.kt:10) test + +User code: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test514.Test514Kt", methodName = "main", fileName = "test514.kt", lineNumber = 10) +} +``` + +### info() { "info messageBuilder $i" } at Test515Kt.main(test515.kt:10) test + +User code: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test515.Test515Kt", methodName = "main", fileName = "test515.kt", lineNumber = 10) +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at Test516Kt.main(test516.kt:10) test + +User code: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test516.Test516Kt", methodName = "main", fileName = "test516.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=null } at Test517Kt.main(test517.kt:10) test + +User code: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test517.Test517Kt", methodName = "main", fileName = "test517.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at Test518Kt.main(test518.kt:10) test + +User code: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test518.Test518Kt", methodName = "main", fileName = "test518.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at Test519Kt.main(test519.kt:10) test + +User code: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test519.Test519Kt", methodName = "main", fileName = "test519.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at Test520Kt.main(test520.kt:10) test + +User code: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test520.Test520Kt", methodName = "main", fileName = "test520.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at Test521Kt.main(test521.kt:10) test + +User code: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test521.Test521Kt", methodName = "main", fileName = "test521.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at Test522Kt.main(test522.kt:10) test + +User code: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test522.Test522Kt", methodName = "main", fileName = "test522.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at Test523Kt.main(test523.kt:10) test + +User code: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test524Kt.main(test524.kt:10) test + +User code: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test525Kt.main(test525.kt:10) test + +User code: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at Test526Kt.main(test526.kt:10) test + +User code: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at Test527Kt.main(test527.kt:10) test + +User code: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at Test528Kt.main(test528.kt:10) test + +User code: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at Test529Kt.main(test529.kt:10) test + +User code: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at Test530Kt.main(test530.kt:10) test + +User code: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test530.Test530Kt", methodName = "main", fileName = "test530.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at Test531Kt.main(test531.kt:10) test + +User code: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test531.Test531Kt", methodName = "main", fileName = "test531.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at Test532Kt.main(test532.kt:10) test + +User code: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test532.Test532Kt", methodName = "main", fileName = "test532.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at Test533Kt.main(test533.kt:10) test + +User code: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test533.Test533Kt", methodName = "main", fileName = "test533.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at Test534Kt.main(test534.kt:10) test + +User code: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test534.Test534Kt", methodName = "main", fileName = "test534.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test535Kt.main(test535.kt:10) test + +User code: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test535.Test535Kt", methodName = "main", fileName = "test535.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at Test536Kt.main(test536.kt:10) test + +User code: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test536.Test536Kt", methodName = "main", fileName = "test536.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at Test537Kt.main(test537.kt:10) test + +User code: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test537.Test537Kt", methodName = "main", fileName = "test537.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test538Kt.main(test538.kt:10) test + +User code: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test538.Test538Kt", methodName = "main", fileName = "test538.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at Test539Kt.main(test539.kt:10) test + +User code: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test540Kt.main(test540.kt:10) test + +User code: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test541Kt.main(test541.kt:10) test + +User code: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}", throwable) at Test545Kt.main(test545.kt:10) test + +User code: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) +} +``` + +Remains as-is: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at Test546Kt.main(test546.kt:10) test + +User code: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test546.Test546Kt", methodName = "main", fileName = "test546.kt", lineNumber = 10) +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at Test547Kt.main(test547.kt:10) test + +User code: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test547.Test547Kt", methodName = "main", fileName = "test547.kt", lineNumber = 10) +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at Test548Kt.main(test548.kt:10) test + +User code: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test548.Test548Kt", methodName = "main", fileName = "test548.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at Test549Kt.main(test549.kt:10) test + +User code: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test549.Test549Kt", methodName = "main", fileName = "test549.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at Test550Kt.main(test550.kt:10) test + +User code: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test550.Test550Kt", methodName = "main", fileName = "test550.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test551Kt.main(test551.kt:10) test + +User code: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test551.Test551Kt", methodName = "main", fileName = "test551.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at Test552Kt.main(test552.kt:10) test + +User code: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test552.Test552Kt", methodName = "main", fileName = "test552.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at Test553Kt.main(test553.kt:10) test + +User code: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test553.Test553Kt", methodName = "main", fileName = "test553.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test554Kt.main(test554.kt:10) test + +User code: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test554.Test554Kt", methodName = "main", fileName = "test554.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at Test555Kt.main(test555.kt:10) test + +User code: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test556Kt.main(test556.kt:10) test + +User code: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test557Kt.main(test557.kt:10) test + +User code: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at Test558Kt.main(test558.kt:10) test + +User code: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at Test559Kt.main(test559.kt:10) test + +User code: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at Test560Kt.main(test560.kt:10) test + +User code: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at Test561Kt.main(test561.kt:10) test + +User code: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at Test565Kt.main(test565.kt:10) test + +User code: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test565.Test565Kt", methodName = "main", fileName = "test565.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at Test566Kt.main(test566.kt:10) test + +User code: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test566.Test566Kt", methodName = "main", fileName = "test566.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test567Kt.main(test567.kt:10) test + +User code: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test567.Test567Kt", methodName = "main", fileName = "test567.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at Test568Kt.main(test568.kt:10) test + +User code: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test568.Test568Kt", methodName = "main", fileName = "test568.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at Test569Kt.main(test569.kt:10) test + +User code: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test569.Test569Kt", methodName = "main", fileName = "test569.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test570Kt.main(test570.kt:10) test + +User code: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test570.Test570Kt", methodName = "main", fileName = "test570.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at Test571Kt.main(test571.kt:10) test + +User code: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test572Kt.main(test572.kt:10) test + +User code: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test573Kt.main(test573.kt:10) test + +User code: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}") at Test577Kt.main(test577.kt:10) test + +User code: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") +} +``` + +Remains as-is: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") +} +``` + +
+ +### warn() { "warn messageBuilder" } at Test578Kt.main(test578.kt:10) test + +User code: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test578.Test578Kt", methodName = "main", fileName = "test578.kt", lineNumber = 10) +} +``` + +### warn() { "warn messageBuilder $i" } at Test579Kt.main(test579.kt:10) test + +User code: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test579.Test579Kt", methodName = "main", fileName = "test579.kt", lineNumber = 10) +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at Test580Kt.main(test580.kt:10) test + +User code: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test580.Test580Kt", methodName = "main", fileName = "test580.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at Test581Kt.main(test581.kt:10) test + +User code: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test581.Test581Kt", methodName = "main", fileName = "test581.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at Test582Kt.main(test582.kt:10) test + +User code: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test582.Test582Kt", methodName = "main", fileName = "test582.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at Test583Kt.main(test583.kt:10) test + +User code: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test583.Test583Kt", methodName = "main", fileName = "test583.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at Test584Kt.main(test584.kt:10) test + +User code: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test584.Test584Kt", methodName = "main", fileName = "test584.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at Test585Kt.main(test585.kt:10) test + +User code: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test585.Test585Kt", methodName = "main", fileName = "test585.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test586Kt.main(test586.kt:10) test + +User code: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test586.Test586Kt", methodName = "main", fileName = "test586.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at Test587Kt.main(test587.kt:10) test + +User code: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test588Kt.main(test588.kt:10) test + +User code: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test589Kt.main(test589.kt:10) test + +User code: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at Test590Kt.main(test590.kt:10) test + +User code: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at Test591Kt.main(test591.kt:10) test + +User code: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at Test592Kt.main(test592.kt:10) test + +User code: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at Test593Kt.main(test593.kt:10) test + +User code: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at Test594Kt.main(test594.kt:10) test + +User code: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test594.Test594Kt", methodName = "main", fileName = "test594.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at Test595Kt.main(test595.kt:10) test + +User code: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test595.Test595Kt", methodName = "main", fileName = "test595.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at Test596Kt.main(test596.kt:10) test + +User code: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test596.Test596Kt", methodName = "main", fileName = "test596.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at Test597Kt.main(test597.kt:10) test + +User code: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test597.Test597Kt", methodName = "main", fileName = "test597.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at Test598Kt.main(test598.kt:10) test + +User code: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test598.Test598Kt", methodName = "main", fileName = "test598.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test599Kt.main(test599.kt:10) test + +User code: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test599.Test599Kt", methodName = "main", fileName = "test599.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at Test600Kt.main(test600.kt:10) test + +User code: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test600.Test600Kt", methodName = "main", fileName = "test600.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at Test601Kt.main(test601.kt:10) test + +User code: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test601.Test601Kt", methodName = "main", fileName = "test601.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test602Kt.main(test602.kt:10) test + +User code: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test602.Test602Kt", methodName = "main", fileName = "test602.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at Test603Kt.main(test603.kt:10) test + +User code: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test604Kt.main(test604.kt:10) test + +User code: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test605Kt.main(test605.kt:10) test + +User code: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### error("error message {}", throwable) at Test609Kt.main(test609.kt:10) test + +User code: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) +} +``` + +Remains as-is: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at Test610Kt.main(test610.kt:10) test + +User code: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test610.Test610Kt", methodName = "main", fileName = "test610.kt", lineNumber = 10) +} +``` + +### error(throwable) { "error messageBuilder $i" } at Test611Kt.main(test611.kt:10) test + +User code: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test611.Test611Kt", methodName = "main", fileName = "test611.kt", lineNumber = 10) +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at Test612Kt.main(test612.kt:10) test + +User code: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test612.Test612Kt", methodName = "main", fileName = "test612.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=throwable } at Test613Kt.main(test613.kt:10) test + +User code: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test613.Test613Kt", methodName = "main", fileName = "test613.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at Test614Kt.main(test614.kt:10) test + +User code: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test614.Test614Kt", methodName = "main", fileName = "test614.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test615Kt.main(test615.kt:10) test + +User code: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test615.Test615Kt", methodName = "main", fileName = "test615.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at Test616Kt.main(test616.kt:10) test + +User code: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test616.Test616Kt", methodName = "main", fileName = "test616.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at Test617Kt.main(test617.kt:10) test + +User code: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test617.Test617Kt", methodName = "main", fileName = "test617.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test618Kt.main(test618.kt:10) test + +User code: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test618.Test618Kt", methodName = "main", fileName = "test618.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at Test619Kt.main(test619.kt:10) test + +User code: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test620Kt.main(test620.kt:10) test + +User code: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test621Kt.main(test621.kt:10) test + +User code: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at Test622Kt.main(test622.kt:10) test + +User code: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at Test623Kt.main(test623.kt:10) test + +User code: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at Test624Kt.main(test624.kt:10) test + +User code: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at Test625Kt.main(test625.kt:10) test + +User code: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at Test629Kt.main(test629.kt:10) test + +User code: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test629.Test629Kt", methodName = "main", fileName = "test629.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at Test630Kt.main(test630.kt:10) test + +User code: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test630.Test630Kt", methodName = "main", fileName = "test630.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test631Kt.main(test631.kt:10) test + +User code: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test631.Test631Kt", methodName = "main", fileName = "test631.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at Test632Kt.main(test632.kt:10) test + +User code: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test632.Test632Kt", methodName = "main", fileName = "test632.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at Test633Kt.main(test633.kt:10) test + +User code: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test633.Test633Kt", methodName = "main", fileName = "test633.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test634Kt.main(test634.kt:10) test + +User code: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test634.Test634Kt", methodName = "main", fileName = "test634.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at Test635Kt.main(test635.kt:10) test + +User code: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test636Kt.main(test636.kt:10) test + +User code: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test637Kt.main(test637.kt:10) test + +User code: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### error("error message {}") at Test641Kt.main(test641.kt:10) test + +User code: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") +} +``` + +Remains as-is: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") +} +``` + +
+ +### error() { "error messageBuilder" } at Test642Kt.main(test642.kt:10) test + +User code: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test642.Test642Kt", methodName = "main", fileName = "test642.kt", lineNumber = 10) +} +``` + +### error() { "error messageBuilder $i" } at Test643Kt.main(test643.kt:10) test + +User code: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test643.Test643Kt", methodName = "main", fileName = "test643.kt", lineNumber = 10) +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at Test644Kt.main(test644.kt:10) test + +User code: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test644.Test644Kt", methodName = "main", fileName = "test644.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=null } at Test645Kt.main(test645.kt:10) test + +User code: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test645.Test645Kt", methodName = "main", fileName = "test645.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at Test646Kt.main(test646.kt:10) test + +User code: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test646.Test646Kt", methodName = "main", fileName = "test646.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at Test647Kt.main(test647.kt:10) test + +User code: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test647.Test647Kt", methodName = "main", fileName = "test647.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at Test648Kt.main(test648.kt:10) test + +User code: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test648.Test648Kt", methodName = "main", fileName = "test648.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at Test649Kt.main(test649.kt:10) test + +User code: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test649.Test649Kt", methodName = "main", fileName = "test649.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at Test650Kt.main(test650.kt:10) test + +User code: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test650.Test650Kt", methodName = "main", fileName = "test650.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
+ +
featureFlag=DISABLE_TRANSFORMING_ENTRY_EXIT_API + +
with class=true + +
entry/exit API + +### entry(argument1, argument2) at MainTest.main(test1.kt:10) test + +User code: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) + } + +} +``` + +Remains as-is: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) + } + +} +``` + +### exit(resultValue) at MainTest.main(test2.kt:10) test + +User code: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) + } + +} +``` + +Remains as-is: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) + } + +} +``` + +### exit() at MainTest.main(test3.kt:10) test + +User code: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() + } + +} +``` + +Remains as-is: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() + } + +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at MainTest.main(test4.kt:10) test + +User code: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) + } + +} +``` + +Transformed into: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "throwing(throwable)", className = "test4.MainTest", methodName = "main", fileName = "test4.kt", lineNumber = 10), throwable) + } + +} +``` + +### catching(throwable) at MainTest.main(test5.kt:10) test + +User code: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) + } + +} +``` + +Transformed into: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catchingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "catching(throwable)", className = "test5.MainTest", methodName = "main", fileName = "test5.kt", lineNumber = 10), throwable) + } + +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at MainTest.main(test6.kt:10) test + +User code: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test6.MainTest", methodName = "main", fileName = "test6.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test7.kt:10) test + +User code: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test7.MainTest", methodName = "main", fileName = "test7.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test8.kt:10) test + +User code: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test8.MainTest", methodName = "main", fileName = "test8.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at MainTest.main(test9.kt:10) test + +User code: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test9.MainTest", methodName = "main", fileName = "test9.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at MainTest.main(test10.kt:10) test + +User code: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test10.MainTest", methodName = "main", fileName = "test10.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test11.kt:10) test + +User code: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test11.MainTest", methodName = "main", fileName = "test11.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at MainTest.main(test12.kt:10) test + +User code: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test12.MainTest", methodName = "main", fileName = "test12.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at MainTest.main(test13.kt:10) test + +User code: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test13.MainTest", methodName = "main", fileName = "test13.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at MainTest.main(test14.kt:10) test + +User code: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test14.MainTest", methodName = "main", fileName = "test14.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test15.kt:10) test + +User code: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test15.MainTest", methodName = "main", fileName = "test15.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test16.kt:10) test + +User code: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test16.MainTest", methodName = "main", fileName = "test16.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test17.kt:10) test + +User code: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test17.MainTest", methodName = "main", fileName = "test17.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test18.kt:10) test + +User code: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test18.MainTest", methodName = "main", fileName = "test18.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test19.kt:10) test + +User code: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test19.MainTest", methodName = "main", fileName = "test19.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test20.kt:10) test + +User code: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test20.MainTest", methodName = "main", fileName = "test20.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test21.kt:10) test + +User code: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test21.MainTest", methodName = "main", fileName = "test21.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at MainTest.main(test22.kt:10) test + +User code: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test22.MainTest", methodName = "main", fileName = "test22.kt", lineNumber = 10) + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test23.kt:10) test + +User code: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test23.MainTest", methodName = "main", fileName = "test23.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test24.kt:10) test + +User code: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test24.MainTest", methodName = "main", fileName = "test24.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}", throwable) at MainTest.main(test28.kt:10) test + +User code: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test28.MainTest", methodName = "main", fileName = "test28.kt", lineNumber = 10) + } + +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at MainTest.main(test29.kt:10) test + +User code: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test29.MainTest", methodName = "main", fileName = "test29.kt", lineNumber = 10) + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at MainTest.main(test30.kt:10) test + +User code: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test30.MainTest", methodName = "main", fileName = "test30.kt", lineNumber = 10) + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test31.kt:10) test + +User code: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test31.MainTest", methodName = "main", fileName = "test31.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at MainTest.main(test32.kt:10) test + +User code: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test32.MainTest", methodName = "main", fileName = "test32.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test33.kt:10) test + +User code: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test33.MainTest", methodName = "main", fileName = "test33.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test34.kt:10) test + +User code: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test34.MainTest", methodName = "main", fileName = "test34.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test35.kt:10) test + +User code: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test35.MainTest", methodName = "main", fileName = "test35.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test36.kt:10) test + +User code: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test36.MainTest", methodName = "main", fileName = "test36.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test37.kt:10) test + +User code: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test37.MainTest", methodName = "main", fileName = "test37.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at MainTest.main(test38.kt:10) test + +User code: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test38.MainTest", methodName = "main", fileName = "test38.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test39.kt:10) test + +User code: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test39.MainTest", methodName = "main", fileName = "test39.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test40.kt:10) test + +User code: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test40.MainTest", methodName = "main", fileName = "test40.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at MainTest.main(test41.kt:10) test + +User code: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test41.MainTest", methodName = "main", fileName = "test41.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at MainTest.main(test42.kt:10) test + +User code: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test42.MainTest", methodName = "main", fileName = "test42.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test43.kt:10) test + +User code: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test43.MainTest", methodName = "main", fileName = "test43.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at MainTest.main(test44.kt:10) test + +User code: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test44.MainTest", methodName = "main", fileName = "test44.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test48.kt:10) test + +User code: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test48.MainTest", methodName = "main", fileName = "test48.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test49.kt:10) test + +User code: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test49.MainTest", methodName = "main", fileName = "test49.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test50.kt:10) test + +User code: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test50.MainTest", methodName = "main", fileName = "test50.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test51.kt:10) test + +User code: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test51.MainTest", methodName = "main", fileName = "test51.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test52.kt:10) test + +User code: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test52.MainTest", methodName = "main", fileName = "test52.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test53.kt:10) test + +User code: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test53.MainTest", methodName = "main", fileName = "test53.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at MainTest.main(test54.kt:10) test + +User code: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test54.MainTest", methodName = "main", fileName = "test54.kt", lineNumber = 10) + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test55.kt:10) test + +User code: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test55.MainTest", methodName = "main", fileName = "test55.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test56.kt:10) test + +User code: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test56.MainTest", methodName = "main", fileName = "test56.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}") at MainTest.main(test60.kt:10) test + +User code: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") + } + +} +``` + +Transformed into: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test60.MainTest", methodName = "main", fileName = "test60.kt", lineNumber = 10) + } + +} +``` + +
+ +### trace() { "trace messageBuilder" } at MainTest.main(test61.kt:10) test + +User code: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test61.MainTest", methodName = "main", fileName = "test61.kt", lineNumber = 10) + } + +} +``` + +### trace() { "trace messageBuilder $i" } at MainTest.main(test62.kt:10) test + +User code: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test62.MainTest", methodName = "main", fileName = "test62.kt", lineNumber = 10) + } + +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at MainTest.main(test63.kt:10) test + +User code: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test63.MainTest", methodName = "main", fileName = "test63.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at MainTest.main(test64.kt:10) test + +User code: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test64.MainTest", methodName = "main", fileName = "test64.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at MainTest.main(test65.kt:10) test + +User code: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test65.MainTest", methodName = "main", fileName = "test65.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test66.kt:10) test + +User code: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test66.MainTest", methodName = "main", fileName = "test66.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at MainTest.main(test67.kt:10) test + +User code: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test67.MainTest", methodName = "main", fileName = "test67.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test68.kt:10) test + +User code: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test68.MainTest", methodName = "main", fileName = "test68.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test69.kt:10) test + +User code: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test69.MainTest", methodName = "main", fileName = "test69.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at MainTest.main(test70.kt:10) test + +User code: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test70.MainTest", methodName = "main", fileName = "test70.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test71.kt:10) test + +User code: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test71.MainTest", methodName = "main", fileName = "test71.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test72.kt:10) test + +User code: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test72.MainTest", methodName = "main", fileName = "test72.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at MainTest.main(test73.kt:10) test + +User code: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test73.MainTest", methodName = "main", fileName = "test73.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at MainTest.main(test74.kt:10) test + +User code: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test74.MainTest", methodName = "main", fileName = "test74.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test75.kt:10) test + +User code: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test75.MainTest", methodName = "main", fileName = "test75.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at MainTest.main(test76.kt:10) test + +User code: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test76.MainTest", methodName = "main", fileName = "test76.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at MainTest.main(test77.kt:10) test + +User code: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test77.MainTest", methodName = "main", fileName = "test77.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at MainTest.main(test78.kt:10) test + +User code: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test78.MainTest", methodName = "main", fileName = "test78.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test79.kt:10) test + +User code: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test79.MainTest", methodName = "main", fileName = "test79.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test80.kt:10) test + +User code: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test80.MainTest", methodName = "main", fileName = "test80.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test81.kt:10) test + +User code: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test81.MainTest", methodName = "main", fileName = "test81.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test82.kt:10) test + +User code: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test82.MainTest", methodName = "main", fileName = "test82.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test83.kt:10) test + +User code: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test83.MainTest", methodName = "main", fileName = "test83.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test84.kt:10) test + +User code: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test84.MainTest", methodName = "main", fileName = "test84.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test85.kt:10) test + +User code: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test85.MainTest", methodName = "main", fileName = "test85.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at MainTest.main(test86.kt:10) test + +User code: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test86.MainTest", methodName = "main", fileName = "test86.kt", lineNumber = 10) + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test87.kt:10) test + +User code: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test87.MainTest", methodName = "main", fileName = "test87.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test88.kt:10) test + +User code: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test88.MainTest", methodName = "main", fileName = "test88.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}", throwable) at MainTest.main(test92.kt:10) test + +User code: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test92.MainTest", methodName = "main", fileName = "test92.kt", lineNumber = 10) + } + +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at MainTest.main(test93.kt:10) test + +User code: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test93.MainTest", methodName = "main", fileName = "test93.kt", lineNumber = 10) + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at MainTest.main(test94.kt:10) test + +User code: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test94.MainTest", methodName = "main", fileName = "test94.kt", lineNumber = 10) + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test95.kt:10) test + +User code: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test95.MainTest", methodName = "main", fileName = "test95.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at MainTest.main(test96.kt:10) test + +User code: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test96.MainTest", methodName = "main", fileName = "test96.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test97.kt:10) test + +User code: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test97.MainTest", methodName = "main", fileName = "test97.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test98.kt:10) test + +User code: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test98.MainTest", methodName = "main", fileName = "test98.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test99.kt:10) test + +User code: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test99.MainTest", methodName = "main", fileName = "test99.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test100.kt:10) test + +User code: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test100.MainTest", methodName = "main", fileName = "test100.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test101.kt:10) test + +User code: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test101.MainTest", methodName = "main", fileName = "test101.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at MainTest.main(test102.kt:10) test + +User code: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test102.MainTest", methodName = "main", fileName = "test102.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test103.kt:10) test + +User code: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test103.MainTest", methodName = "main", fileName = "test103.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test104.kt:10) test + +User code: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test104.MainTest", methodName = "main", fileName = "test104.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at MainTest.main(test105.kt:10) test + +User code: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test105.MainTest", methodName = "main", fileName = "test105.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at MainTest.main(test106.kt:10) test + +User code: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test106.MainTest", methodName = "main", fileName = "test106.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test107.kt:10) test + +User code: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test107.MainTest", methodName = "main", fileName = "test107.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at MainTest.main(test108.kt:10) test + +User code: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test108.MainTest", methodName = "main", fileName = "test108.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test112.kt:10) test + +User code: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test112.MainTest", methodName = "main", fileName = "test112.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test113.kt:10) test + +User code: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test113.MainTest", methodName = "main", fileName = "test113.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test114.kt:10) test + +User code: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test114.MainTest", methodName = "main", fileName = "test114.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test115.kt:10) test + +User code: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test115.MainTest", methodName = "main", fileName = "test115.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test116.kt:10) test + +User code: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test116.MainTest", methodName = "main", fileName = "test116.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test117.kt:10) test + +User code: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test117.MainTest", methodName = "main", fileName = "test117.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at MainTest.main(test118.kt:10) test + +User code: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test118.MainTest", methodName = "main", fileName = "test118.kt", lineNumber = 10) + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test119.kt:10) test + +User code: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test119.MainTest", methodName = "main", fileName = "test119.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test120.kt:10) test + +User code: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test120.MainTest", methodName = "main", fileName = "test120.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}") at MainTest.main(test124.kt:10) test + +User code: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") + } + +} +``` + +Transformed into: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test124.MainTest", methodName = "main", fileName = "test124.kt", lineNumber = 10) + } + +} +``` + +
+ +### debug() { "debug messageBuilder" } at MainTest.main(test125.kt:10) test + +User code: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test125.MainTest", methodName = "main", fileName = "test125.kt", lineNumber = 10) + } + +} +``` + +### debug() { "debug messageBuilder $i" } at MainTest.main(test126.kt:10) test + +User code: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test126.MainTest", methodName = "main", fileName = "test126.kt", lineNumber = 10) + } + +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at MainTest.main(test127.kt:10) test + +User code: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test127.MainTest", methodName = "main", fileName = "test127.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at MainTest.main(test128.kt:10) test + +User code: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test128.MainTest", methodName = "main", fileName = "test128.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at MainTest.main(test129.kt:10) test + +User code: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test129.MainTest", methodName = "main", fileName = "test129.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test130.kt:10) test + +User code: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test130.MainTest", methodName = "main", fileName = "test130.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at MainTest.main(test131.kt:10) test + +User code: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test131.MainTest", methodName = "main", fileName = "test131.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test132.kt:10) test + +User code: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test132.MainTest", methodName = "main", fileName = "test132.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test133.kt:10) test + +User code: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test133.MainTest", methodName = "main", fileName = "test133.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at MainTest.main(test134.kt:10) test + +User code: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test134.MainTest", methodName = "main", fileName = "test134.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test135.kt:10) test + +User code: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test135.MainTest", methodName = "main", fileName = "test135.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test136.kt:10) test + +User code: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test136.MainTest", methodName = "main", fileName = "test136.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at MainTest.main(test137.kt:10) test + +User code: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test137.MainTest", methodName = "main", fileName = "test137.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at MainTest.main(test138.kt:10) test + +User code: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test138.MainTest", methodName = "main", fileName = "test138.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test139.kt:10) test + +User code: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test139.MainTest", methodName = "main", fileName = "test139.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at MainTest.main(test140.kt:10) test + +User code: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test140.MainTest", methodName = "main", fileName = "test140.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at MainTest.main(test141.kt:10) test + +User code: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test141.MainTest", methodName = "main", fileName = "test141.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at MainTest.main(test142.kt:10) test + +User code: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test142.MainTest", methodName = "main", fileName = "test142.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test143.kt:10) test + +User code: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test143.MainTest", methodName = "main", fileName = "test143.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test144.kt:10) test + +User code: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test144.MainTest", methodName = "main", fileName = "test144.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test145.kt:10) test + +User code: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test145.MainTest", methodName = "main", fileName = "test145.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test146.kt:10) test + +User code: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test146.MainTest", methodName = "main", fileName = "test146.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test147.kt:10) test + +User code: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test147.MainTest", methodName = "main", fileName = "test147.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test148.kt:10) test + +User code: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test148.MainTest", methodName = "main", fileName = "test148.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test149.kt:10) test + +User code: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test149.MainTest", methodName = "main", fileName = "test149.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at MainTest.main(test150.kt:10) test + +User code: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test150.MainTest", methodName = "main", fileName = "test150.kt", lineNumber = 10) + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test151.kt:10) test + +User code: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test151.MainTest", methodName = "main", fileName = "test151.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test152.kt:10) test + +User code: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test152.MainTest", methodName = "main", fileName = "test152.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}", throwable) at MainTest.main(test156.kt:10) test + +User code: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test156.MainTest", methodName = "main", fileName = "test156.kt", lineNumber = 10) + } + +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at MainTest.main(test157.kt:10) test + +User code: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test157.MainTest", methodName = "main", fileName = "test157.kt", lineNumber = 10) + } + +} +``` + +### info(throwable) { "info messageBuilder $i" } at MainTest.main(test158.kt:10) test + +User code: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test158.MainTest", methodName = "main", fileName = "test158.kt", lineNumber = 10) + } + +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test159.kt:10) test + +User code: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test159.MainTest", methodName = "main", fileName = "test159.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at MainTest.main(test160.kt:10) test + +User code: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test160.MainTest", methodName = "main", fileName = "test160.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test161.kt:10) test + +User code: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test161.MainTest", methodName = "main", fileName = "test161.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test162.kt:10) test + +User code: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test162.MainTest", methodName = "main", fileName = "test162.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at MainTest.main(test163.kt:10) test + +User code: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test163.MainTest", methodName = "main", fileName = "test163.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test164.kt:10) test + +User code: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test164.MainTest", methodName = "main", fileName = "test164.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test165.kt:10) test + +User code: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test165.MainTest", methodName = "main", fileName = "test165.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at MainTest.main(test166.kt:10) test + +User code: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test166.MainTest", methodName = "main", fileName = "test166.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test167.kt:10) test + +User code: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test167.MainTest", methodName = "main", fileName = "test167.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test168.kt:10) test + +User code: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test168.MainTest", methodName = "main", fileName = "test168.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at MainTest.main(test169.kt:10) test + +User code: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test169.MainTest", methodName = "main", fileName = "test169.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at MainTest.main(test170.kt:10) test + +User code: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test170.MainTest", methodName = "main", fileName = "test170.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test171.kt:10) test + +User code: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test171.MainTest", methodName = "main", fileName = "test171.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at MainTest.main(test172.kt:10) test + +User code: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test172.MainTest", methodName = "main", fileName = "test172.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at MainTest.main(test176.kt:10) test + +User code: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test176.MainTest", methodName = "main", fileName = "test176.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test177.kt:10) test + +User code: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test177.MainTest", methodName = "main", fileName = "test177.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test178.kt:10) test + +User code: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test178.MainTest", methodName = "main", fileName = "test178.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at MainTest.main(test179.kt:10) test + +User code: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test179.MainTest", methodName = "main", fileName = "test179.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test180.kt:10) test + +User code: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test180.MainTest", methodName = "main", fileName = "test180.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test181.kt:10) test + +User code: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test181.MainTest", methodName = "main", fileName = "test181.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at MainTest.main(test182.kt:10) test + +User code: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test182.MainTest", methodName = "main", fileName = "test182.kt", lineNumber = 10) + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test183.kt:10) test + +User code: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test183.MainTest", methodName = "main", fileName = "test183.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test184.kt:10) test + +User code: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test184.MainTest", methodName = "main", fileName = "test184.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}") at MainTest.main(test188.kt:10) test + +User code: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") + } + +} +``` + +Transformed into: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test188.MainTest", methodName = "main", fileName = "test188.kt", lineNumber = 10) + } + +} +``` + +
+ +### info() { "info messageBuilder" } at MainTest.main(test189.kt:10) test + +User code: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test189.MainTest", methodName = "main", fileName = "test189.kt", lineNumber = 10) + } + +} +``` + +### info() { "info messageBuilder $i" } at MainTest.main(test190.kt:10) test + +User code: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test190.MainTest", methodName = "main", fileName = "test190.kt", lineNumber = 10) + } + +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at MainTest.main(test191.kt:10) test + +User code: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test191.MainTest", methodName = "main", fileName = "test191.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=null } at MainTest.main(test192.kt:10) test + +User code: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test192.MainTest", methodName = "main", fileName = "test192.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at MainTest.main(test193.kt:10) test + +User code: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test193.MainTest", methodName = "main", fileName = "test193.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test194.kt:10) test + +User code: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test194.MainTest", methodName = "main", fileName = "test194.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at MainTest.main(test195.kt:10) test + +User code: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test195.MainTest", methodName = "main", fileName = "test195.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at MainTest.main(test196.kt:10) test + +User code: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test196.MainTest", methodName = "main", fileName = "test196.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test197.kt:10) test + +User code: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test197.MainTest", methodName = "main", fileName = "test197.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at MainTest.main(test198.kt:10) test + +User code: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test198.MainTest", methodName = "main", fileName = "test198.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test199.kt:10) test + +User code: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test199.MainTest", methodName = "main", fileName = "test199.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test200.kt:10) test + +User code: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test200.MainTest", methodName = "main", fileName = "test200.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at MainTest.main(test201.kt:10) test + +User code: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test201.MainTest", methodName = "main", fileName = "test201.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at MainTest.main(test202.kt:10) test + +User code: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test202.MainTest", methodName = "main", fileName = "test202.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test203.kt:10) test + +User code: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test203.MainTest", methodName = "main", fileName = "test203.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at MainTest.main(test204.kt:10) test + +User code: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test204.MainTest", methodName = "main", fileName = "test204.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at MainTest.main(test205.kt:10) test + +User code: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test205.MainTest", methodName = "main", fileName = "test205.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at MainTest.main(test206.kt:10) test + +User code: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test206.MainTest", methodName = "main", fileName = "test206.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test207.kt:10) test + +User code: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test207.MainTest", methodName = "main", fileName = "test207.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test208.kt:10) test + +User code: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test208.MainTest", methodName = "main", fileName = "test208.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test209.kt:10) test + +User code: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test209.MainTest", methodName = "main", fileName = "test209.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test210.kt:10) test + +User code: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test210.MainTest", methodName = "main", fileName = "test210.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test211.kt:10) test + +User code: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test211.MainTest", methodName = "main", fileName = "test211.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test212.kt:10) test + +User code: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test212.MainTest", methodName = "main", fileName = "test212.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test213.kt:10) test + +User code: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test213.MainTest", methodName = "main", fileName = "test213.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at MainTest.main(test214.kt:10) test + +User code: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test214.MainTest", methodName = "main", fileName = "test214.kt", lineNumber = 10) + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test215.kt:10) test + +User code: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test215.MainTest", methodName = "main", fileName = "test215.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test216.kt:10) test + +User code: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test216.MainTest", methodName = "main", fileName = "test216.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}", throwable) at MainTest.main(test220.kt:10) test + +User code: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test220.MainTest", methodName = "main", fileName = "test220.kt", lineNumber = 10) + } + +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at MainTest.main(test221.kt:10) test + +User code: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test221.MainTest", methodName = "main", fileName = "test221.kt", lineNumber = 10) + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at MainTest.main(test222.kt:10) test + +User code: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test222.MainTest", methodName = "main", fileName = "test222.kt", lineNumber = 10) + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test223.kt:10) test + +User code: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test223.MainTest", methodName = "main", fileName = "test223.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at MainTest.main(test224.kt:10) test + +User code: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test224.MainTest", methodName = "main", fileName = "test224.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test225.kt:10) test + +User code: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test225.MainTest", methodName = "main", fileName = "test225.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test226.kt:10) test + +User code: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test226.MainTest", methodName = "main", fileName = "test226.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test227.kt:10) test + +User code: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test227.MainTest", methodName = "main", fileName = "test227.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test228.kt:10) test + +User code: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test228.MainTest", methodName = "main", fileName = "test228.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test229.kt:10) test + +User code: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test229.MainTest", methodName = "main", fileName = "test229.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at MainTest.main(test230.kt:10) test + +User code: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test230.MainTest", methodName = "main", fileName = "test230.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test231.kt:10) test + +User code: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test231.MainTest", methodName = "main", fileName = "test231.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test232.kt:10) test + +User code: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test232.MainTest", methodName = "main", fileName = "test232.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at MainTest.main(test233.kt:10) test + +User code: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test233.MainTest", methodName = "main", fileName = "test233.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at MainTest.main(test234.kt:10) test + +User code: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test234.MainTest", methodName = "main", fileName = "test234.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test235.kt:10) test + +User code: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test235.MainTest", methodName = "main", fileName = "test235.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at MainTest.main(test236.kt:10) test + +User code: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test236.MainTest", methodName = "main", fileName = "test236.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test240.kt:10) test + +User code: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test240.MainTest", methodName = "main", fileName = "test240.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test241.kt:10) test + +User code: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test241.MainTest", methodName = "main", fileName = "test241.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test242.kt:10) test + +User code: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test242.MainTest", methodName = "main", fileName = "test242.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test243.kt:10) test + +User code: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test243.MainTest", methodName = "main", fileName = "test243.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test244.kt:10) test + +User code: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test244.MainTest", methodName = "main", fileName = "test244.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test245.kt:10) test + +User code: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test245.MainTest", methodName = "main", fileName = "test245.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at MainTest.main(test246.kt:10) test + +User code: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test246.MainTest", methodName = "main", fileName = "test246.kt", lineNumber = 10) + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test247.kt:10) test + +User code: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test247.MainTest", methodName = "main", fileName = "test247.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test248.kt:10) test + +User code: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test248.MainTest", methodName = "main", fileName = "test248.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}") at MainTest.main(test252.kt:10) test + +User code: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") + } + +} +``` + +Transformed into: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test252.MainTest", methodName = "main", fileName = "test252.kt", lineNumber = 10) + } + +} +``` + +
+ +### warn() { "warn messageBuilder" } at MainTest.main(test253.kt:10) test + +User code: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test253.MainTest", methodName = "main", fileName = "test253.kt", lineNumber = 10) + } + +} +``` + +### warn() { "warn messageBuilder $i" } at MainTest.main(test254.kt:10) test + +User code: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test254.MainTest", methodName = "main", fileName = "test254.kt", lineNumber = 10) + } + +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at MainTest.main(test255.kt:10) test + +User code: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test255.MainTest", methodName = "main", fileName = "test255.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at MainTest.main(test256.kt:10) test + +User code: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test256.MainTest", methodName = "main", fileName = "test256.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at MainTest.main(test257.kt:10) test + +User code: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test257.MainTest", methodName = "main", fileName = "test257.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test258.kt:10) test + +User code: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test258.MainTest", methodName = "main", fileName = "test258.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at MainTest.main(test259.kt:10) test + +User code: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test259.MainTest", methodName = "main", fileName = "test259.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test260.kt:10) test + +User code: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test260.MainTest", methodName = "main", fileName = "test260.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test261.kt:10) test + +User code: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test261.MainTest", methodName = "main", fileName = "test261.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at MainTest.main(test262.kt:10) test + +User code: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test262.MainTest", methodName = "main", fileName = "test262.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test263.kt:10) test + +User code: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test263.MainTest", methodName = "main", fileName = "test263.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test264.kt:10) test + +User code: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test264.MainTest", methodName = "main", fileName = "test264.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at MainTest.main(test265.kt:10) test + +User code: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test265.MainTest", methodName = "main", fileName = "test265.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at MainTest.main(test266.kt:10) test + +User code: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test266.MainTest", methodName = "main", fileName = "test266.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test267.kt:10) test + +User code: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test267.MainTest", methodName = "main", fileName = "test267.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at MainTest.main(test268.kt:10) test + +User code: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test268.MainTest", methodName = "main", fileName = "test268.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at MainTest.main(test269.kt:10) test + +User code: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test269.MainTest", methodName = "main", fileName = "test269.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at MainTest.main(test270.kt:10) test + +User code: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test270.MainTest", methodName = "main", fileName = "test270.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test271.kt:10) test + +User code: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test271.MainTest", methodName = "main", fileName = "test271.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test272.kt:10) test + +User code: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test272.MainTest", methodName = "main", fileName = "test272.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test273.kt:10) test + +User code: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test273.MainTest", methodName = "main", fileName = "test273.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test274.kt:10) test + +User code: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test274.MainTest", methodName = "main", fileName = "test274.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test275.kt:10) test + +User code: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test275.MainTest", methodName = "main", fileName = "test275.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test276.kt:10) test + +User code: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test276.MainTest", methodName = "main", fileName = "test276.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test277.kt:10) test + +User code: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test277.MainTest", methodName = "main", fileName = "test277.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at MainTest.main(test278.kt:10) test + +User code: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test278.MainTest", methodName = "main", fileName = "test278.kt", lineNumber = 10) + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test279.kt:10) test + +User code: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test279.MainTest", methodName = "main", fileName = "test279.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test280.kt:10) test + +User code: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test280.MainTest", methodName = "main", fileName = "test280.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}", throwable) at MainTest.main(test284.kt:10) test + +User code: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test284.MainTest", methodName = "main", fileName = "test284.kt", lineNumber = 10) + } + +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at MainTest.main(test285.kt:10) test + +User code: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test285.MainTest", methodName = "main", fileName = "test285.kt", lineNumber = 10) + } + +} +``` + +### error(throwable) { "error messageBuilder $i" } at MainTest.main(test286.kt:10) test + +User code: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test286.MainTest", methodName = "main", fileName = "test286.kt", lineNumber = 10) + } + +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test287.kt:10) test + +User code: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test287.MainTest", methodName = "main", fileName = "test287.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=throwable } at MainTest.main(test288.kt:10) test + +User code: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test288.MainTest", methodName = "main", fileName = "test288.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test289.kt:10) test + +User code: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test289.MainTest", methodName = "main", fileName = "test289.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test290.kt:10) test + +User code: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test290.MainTest", methodName = "main", fileName = "test290.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at MainTest.main(test291.kt:10) test + +User code: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test291.MainTest", methodName = "main", fileName = "test291.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test292.kt:10) test + +User code: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test292.MainTest", methodName = "main", fileName = "test292.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test293.kt:10) test + +User code: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test293.MainTest", methodName = "main", fileName = "test293.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at MainTest.main(test294.kt:10) test + +User code: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test294.MainTest", methodName = "main", fileName = "test294.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test295.kt:10) test + +User code: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test295.MainTest", methodName = "main", fileName = "test295.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test296.kt:10) test + +User code: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test296.MainTest", methodName = "main", fileName = "test296.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at MainTest.main(test297.kt:10) test + +User code: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test297.MainTest", methodName = "main", fileName = "test297.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at MainTest.main(test298.kt:10) test + +User code: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test298.MainTest", methodName = "main", fileName = "test298.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test299.kt:10) test + +User code: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test299.MainTest", methodName = "main", fileName = "test299.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at MainTest.main(test300.kt:10) test + +User code: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test300.MainTest", methodName = "main", fileName = "test300.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at MainTest.main(test304.kt:10) test + +User code: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test304.MainTest", methodName = "main", fileName = "test304.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test305.kt:10) test + +User code: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test305.MainTest", methodName = "main", fileName = "test305.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test306.kt:10) test + +User code: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test306.MainTest", methodName = "main", fileName = "test306.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at MainTest.main(test307.kt:10) test + +User code: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test307.MainTest", methodName = "main", fileName = "test307.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test308.kt:10) test + +User code: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test308.MainTest", methodName = "main", fileName = "test308.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test309.kt:10) test + +User code: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test309.MainTest", methodName = "main", fileName = "test309.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at MainTest.main(test310.kt:10) test + +User code: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test310.MainTest", methodName = "main", fileName = "test310.kt", lineNumber = 10) + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test311.kt:10) test + +User code: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test311.MainTest", methodName = "main", fileName = "test311.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test312.kt:10) test + +User code: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test312.MainTest", methodName = "main", fileName = "test312.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}") at MainTest.main(test316.kt:10) test + +User code: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") + } + +} +``` + +Transformed into: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test316.MainTest", methodName = "main", fileName = "test316.kt", lineNumber = 10) + } + +} +``` + +
+ +### error() { "error messageBuilder" } at MainTest.main(test317.kt:10) test + +User code: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test317.MainTest", methodName = "main", fileName = "test317.kt", lineNumber = 10) + } + +} +``` + +### error() { "error messageBuilder $i" } at MainTest.main(test318.kt:10) test + +User code: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test318.MainTest", methodName = "main", fileName = "test318.kt", lineNumber = 10) + } + +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at MainTest.main(test319.kt:10) test + +User code: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test319.MainTest", methodName = "main", fileName = "test319.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=null } at MainTest.main(test320.kt:10) test + +User code: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test320.MainTest", methodName = "main", fileName = "test320.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at MainTest.main(test321.kt:10) test + +User code: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test321.MainTest", methodName = "main", fileName = "test321.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test322.kt:10) test + +User code: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test322.MainTest", methodName = "main", fileName = "test322.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at MainTest.main(test323.kt:10) test + +User code: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test323.MainTest", methodName = "main", fileName = "test323.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at MainTest.main(test324.kt:10) test + +User code: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test324.MainTest", methodName = "main", fileName = "test324.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test325.kt:10) test + +User code: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test325.MainTest", methodName = "main", fileName = "test325.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
+ +
with class=false + +
entry/exit API + +### entry(argument1, argument2) at Test326Kt.main(test326.kt:10) test + +User code: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) +} +``` + +Remains as-is: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) +} +``` + +### exit(resultValue) at Test327Kt.main(test327.kt:10) test + +User code: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) +} +``` + +Remains as-is: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) +} +``` + +### exit() at Test328Kt.main(test328.kt:10) test + +User code: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() +} +``` + +Remains as-is: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at Test329Kt.main(test329.kt:10) test + +User code: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) +} +``` + +Transformed into: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "throwing(throwable)", className = "test329.Test329Kt", methodName = "main", fileName = "test329.kt", lineNumber = 10), throwable) +} +``` + +### catching(throwable) at Test330Kt.main(test330.kt:10) test + +User code: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) +} +``` + +Transformed into: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catchingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "catching(throwable)", className = "test330.Test330Kt", methodName = "main", fileName = "test330.kt", lineNumber = 10), throwable) +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at Test331Kt.main(test331.kt:10) test + +User code: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test331.Test331Kt", methodName = "main", fileName = "test331.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test332Kt.main(test332.kt:10) test + +User code: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test332.Test332Kt", methodName = "main", fileName = "test332.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test333Kt.main(test333.kt:10) test + +User code: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test333.Test333Kt", methodName = "main", fileName = "test333.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at Test334Kt.main(test334.kt:10) test + +User code: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test334.Test334Kt", methodName = "main", fileName = "test334.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at Test335Kt.main(test335.kt:10) test + +User code: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test335.Test335Kt", methodName = "main", fileName = "test335.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at Test336Kt.main(test336.kt:10) test + +User code: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test336.Test336Kt", methodName = "main", fileName = "test336.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at Test337Kt.main(test337.kt:10) test + +User code: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test337.Test337Kt", methodName = "main", fileName = "test337.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at Test338Kt.main(test338.kt:10) test + +User code: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test338.Test338Kt", methodName = "main", fileName = "test338.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at Test339Kt.main(test339.kt:10) test + +User code: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test339.Test339Kt", methodName = "main", fileName = "test339.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at Test340Kt.main(test340.kt:10) test + +User code: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test340.Test340Kt", methodName = "main", fileName = "test340.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at Test341Kt.main(test341.kt:10) test + +User code: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test341.Test341Kt", methodName = "main", fileName = "test341.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at Test342Kt.main(test342.kt:10) test + +User code: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test342.Test342Kt", methodName = "main", fileName = "test342.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test343Kt.main(test343.kt:10) test + +User code: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test343.Test343Kt", methodName = "main", fileName = "test343.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at Test344Kt.main(test344.kt:10) test + +User code: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test344.Test344Kt", methodName = "main", fileName = "test344.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at Test345Kt.main(test345.kt:10) test + +User code: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test345.Test345Kt", methodName = "main", fileName = "test345.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test346Kt.main(test346.kt:10) test + +User code: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test346.Test346Kt", methodName = "main", fileName = "test346.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at Test347Kt.main(test347.kt:10) test + +User code: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test347.Test347Kt", methodName = "main", fileName = "test347.kt", lineNumber = 10) +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test348Kt.main(test348.kt:10) test + +User code: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test348.Test348Kt", methodName = "main", fileName = "test348.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test349Kt.main(test349.kt:10) test + +User code: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test349.Test349Kt", methodName = "main", fileName = "test349.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}", throwable) at Test353Kt.main(test353.kt:10) test + +User code: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test353.Test353Kt", methodName = "main", fileName = "test353.kt", lineNumber = 10) +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at Test354Kt.main(test354.kt:10) test + +User code: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test354.Test354Kt", methodName = "main", fileName = "test354.kt", lineNumber = 10) +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at Test355Kt.main(test355.kt:10) test + +User code: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test355.Test355Kt", methodName = "main", fileName = "test355.kt", lineNumber = 10) +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at Test356Kt.main(test356.kt:10) test + +User code: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test356.Test356Kt", methodName = "main", fileName = "test356.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at Test357Kt.main(test357.kt:10) test + +User code: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test357.Test357Kt", methodName = "main", fileName = "test357.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at Test358Kt.main(test358.kt:10) test + +User code: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test358.Test358Kt", methodName = "main", fileName = "test358.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test359Kt.main(test359.kt:10) test + +User code: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test359.Test359Kt", methodName = "main", fileName = "test359.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at Test360Kt.main(test360.kt:10) test + +User code: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test360.Test360Kt", methodName = "main", fileName = "test360.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at Test361Kt.main(test361.kt:10) test + +User code: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test361.Test361Kt", methodName = "main", fileName = "test361.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test362Kt.main(test362.kt:10) test + +User code: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test362.Test362Kt", methodName = "main", fileName = "test362.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at Test363Kt.main(test363.kt:10) test + +User code: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test363.Test363Kt", methodName = "main", fileName = "test363.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test364Kt.main(test364.kt:10) test + +User code: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test364.Test364Kt", methodName = "main", fileName = "test364.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test365Kt.main(test365.kt:10) test + +User code: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test365.Test365Kt", methodName = "main", fileName = "test365.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at Test366Kt.main(test366.kt:10) test + +User code: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test366.Test366Kt", methodName = "main", fileName = "test366.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at Test367Kt.main(test367.kt:10) test + +User code: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test367.Test367Kt", methodName = "main", fileName = "test367.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at Test368Kt.main(test368.kt:10) test + +User code: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test368.Test368Kt", methodName = "main", fileName = "test368.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at Test369Kt.main(test369.kt:10) test + +User code: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test369.Test369Kt", methodName = "main", fileName = "test369.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at Test373Kt.main(test373.kt:10) test + +User code: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test373.Test373Kt", methodName = "main", fileName = "test373.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at Test374Kt.main(test374.kt:10) test + +User code: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test374.Test374Kt", methodName = "main", fileName = "test374.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test375Kt.main(test375.kt:10) test + +User code: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test375.Test375Kt", methodName = "main", fileName = "test375.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at Test376Kt.main(test376.kt:10) test + +User code: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test376.Test376Kt", methodName = "main", fileName = "test376.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at Test377Kt.main(test377.kt:10) test + +User code: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test377.Test377Kt", methodName = "main", fileName = "test377.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test378Kt.main(test378.kt:10) test + +User code: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test378.Test378Kt", methodName = "main", fileName = "test378.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at Test379Kt.main(test379.kt:10) test + +User code: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) +} +``` + +Transformed into: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test379.Test379Kt", methodName = "main", fileName = "test379.kt", lineNumber = 10) +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test380Kt.main(test380.kt:10) test + +User code: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test380.Test380Kt", methodName = "main", fileName = "test380.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test381Kt.main(test381.kt:10) test + +User code: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test381.Test381Kt", methodName = "main", fileName = "test381.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}") at Test385Kt.main(test385.kt:10) test + +User code: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") +} +``` + +Transformed into: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test385.Test385Kt", methodName = "main", fileName = "test385.kt", lineNumber = 10) +} +``` + +
+ +### trace() { "trace messageBuilder" } at Test386Kt.main(test386.kt:10) test + +User code: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test386.Test386Kt", methodName = "main", fileName = "test386.kt", lineNumber = 10) +} +``` + +### trace() { "trace messageBuilder $i" } at Test387Kt.main(test387.kt:10) test + +User code: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test387.Test387Kt", methodName = "main", fileName = "test387.kt", lineNumber = 10) +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at Test388Kt.main(test388.kt:10) test + +User code: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test388.Test388Kt", methodName = "main", fileName = "test388.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at Test389Kt.main(test389.kt:10) test + +User code: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test389.Test389Kt", methodName = "main", fileName = "test389.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at Test390Kt.main(test390.kt:10) test + +User code: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test390.Test390Kt", methodName = "main", fileName = "test390.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at Test391Kt.main(test391.kt:10) test + +User code: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test391.Test391Kt", methodName = "main", fileName = "test391.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at Test392Kt.main(test392.kt:10) test + +User code: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test392.Test392Kt", methodName = "main", fileName = "test392.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at Test393Kt.main(test393.kt:10) test + +User code: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test393.Test393Kt", methodName = "main", fileName = "test393.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test394Kt.main(test394.kt:10) test + +User code: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test394.Test394Kt", methodName = "main", fileName = "test394.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at Test395Kt.main(test395.kt:10) test + +User code: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test395.Test395Kt", methodName = "main", fileName = "test395.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test396Kt.main(test396.kt:10) test + +User code: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test396.Test396Kt", methodName = "main", fileName = "test396.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test397Kt.main(test397.kt:10) test + +User code: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test397.Test397Kt", methodName = "main", fileName = "test397.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at Test398Kt.main(test398.kt:10) test + +User code: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test398.Test398Kt", methodName = "main", fileName = "test398.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at Test399Kt.main(test399.kt:10) test + +User code: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test399.Test399Kt", methodName = "main", fileName = "test399.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at Test400Kt.main(test400.kt:10) test + +User code: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test400.Test400Kt", methodName = "main", fileName = "test400.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at Test401Kt.main(test401.kt:10) test + +User code: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test401.Test401Kt", methodName = "main", fileName = "test401.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at Test402Kt.main(test402.kt:10) test + +User code: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test402.Test402Kt", methodName = "main", fileName = "test402.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at Test403Kt.main(test403.kt:10) test + +User code: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test403.Test403Kt", methodName = "main", fileName = "test403.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at Test404Kt.main(test404.kt:10) test + +User code: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test404.Test404Kt", methodName = "main", fileName = "test404.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at Test405Kt.main(test405.kt:10) test + +User code: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test405.Test405Kt", methodName = "main", fileName = "test405.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at Test406Kt.main(test406.kt:10) test + +User code: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test406.Test406Kt", methodName = "main", fileName = "test406.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test407Kt.main(test407.kt:10) test + +User code: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test407.Test407Kt", methodName = "main", fileName = "test407.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at Test408Kt.main(test408.kt:10) test + +User code: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test408.Test408Kt", methodName = "main", fileName = "test408.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at Test409Kt.main(test409.kt:10) test + +User code: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test409.Test409Kt", methodName = "main", fileName = "test409.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test410Kt.main(test410.kt:10) test + +User code: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test410.Test410Kt", methodName = "main", fileName = "test410.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at Test411Kt.main(test411.kt:10) test + +User code: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test411.Test411Kt", methodName = "main", fileName = "test411.kt", lineNumber = 10) +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test412Kt.main(test412.kt:10) test + +User code: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test412.Test412Kt", methodName = "main", fileName = "test412.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test413Kt.main(test413.kt:10) test + +User code: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test413.Test413Kt", methodName = "main", fileName = "test413.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}", throwable) at Test417Kt.main(test417.kt:10) test + +User code: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test417.Test417Kt", methodName = "main", fileName = "test417.kt", lineNumber = 10) +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at Test418Kt.main(test418.kt:10) test + +User code: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test418.Test418Kt", methodName = "main", fileName = "test418.kt", lineNumber = 10) +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at Test419Kt.main(test419.kt:10) test + +User code: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test419.Test419Kt", methodName = "main", fileName = "test419.kt", lineNumber = 10) +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at Test420Kt.main(test420.kt:10) test + +User code: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test420.Test420Kt", methodName = "main", fileName = "test420.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at Test421Kt.main(test421.kt:10) test + +User code: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test421.Test421Kt", methodName = "main", fileName = "test421.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at Test422Kt.main(test422.kt:10) test + +User code: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test422.Test422Kt", methodName = "main", fileName = "test422.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test423Kt.main(test423.kt:10) test + +User code: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test423.Test423Kt", methodName = "main", fileName = "test423.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at Test424Kt.main(test424.kt:10) test + +User code: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test424.Test424Kt", methodName = "main", fileName = "test424.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at Test425Kt.main(test425.kt:10) test + +User code: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test425.Test425Kt", methodName = "main", fileName = "test425.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test426Kt.main(test426.kt:10) test + +User code: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test426.Test426Kt", methodName = "main", fileName = "test426.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at Test427Kt.main(test427.kt:10) test + +User code: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test427.Test427Kt", methodName = "main", fileName = "test427.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test428Kt.main(test428.kt:10) test + +User code: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test428.Test428Kt", methodName = "main", fileName = "test428.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test429Kt.main(test429.kt:10) test + +User code: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test429.Test429Kt", methodName = "main", fileName = "test429.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at Test430Kt.main(test430.kt:10) test + +User code: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test430.Test430Kt", methodName = "main", fileName = "test430.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at Test431Kt.main(test431.kt:10) test + +User code: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test431.Test431Kt", methodName = "main", fileName = "test431.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at Test432Kt.main(test432.kt:10) test + +User code: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test432.Test432Kt", methodName = "main", fileName = "test432.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at Test433Kt.main(test433.kt:10) test + +User code: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test433.Test433Kt", methodName = "main", fileName = "test433.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at Test437Kt.main(test437.kt:10) test + +User code: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test437.Test437Kt", methodName = "main", fileName = "test437.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at Test438Kt.main(test438.kt:10) test + +User code: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test438.Test438Kt", methodName = "main", fileName = "test438.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test439Kt.main(test439.kt:10) test + +User code: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test439.Test439Kt", methodName = "main", fileName = "test439.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at Test440Kt.main(test440.kt:10) test + +User code: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test440.Test440Kt", methodName = "main", fileName = "test440.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at Test441Kt.main(test441.kt:10) test + +User code: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test441.Test441Kt", methodName = "main", fileName = "test441.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test442Kt.main(test442.kt:10) test + +User code: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test442.Test442Kt", methodName = "main", fileName = "test442.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at Test443Kt.main(test443.kt:10) test + +User code: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) +} +``` + +Transformed into: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test443.Test443Kt", methodName = "main", fileName = "test443.kt", lineNumber = 10) +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test444Kt.main(test444.kt:10) test + +User code: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test444.Test444Kt", methodName = "main", fileName = "test444.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test445Kt.main(test445.kt:10) test + +User code: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test445.Test445Kt", methodName = "main", fileName = "test445.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}") at Test449Kt.main(test449.kt:10) test + +User code: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") +} +``` + +Transformed into: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test449.Test449Kt", methodName = "main", fileName = "test449.kt", lineNumber = 10) +} +``` + +
+ +### debug() { "debug messageBuilder" } at Test450Kt.main(test450.kt:10) test + +User code: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test450.Test450Kt", methodName = "main", fileName = "test450.kt", lineNumber = 10) +} +``` + +### debug() { "debug messageBuilder $i" } at Test451Kt.main(test451.kt:10) test + +User code: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test451.Test451Kt", methodName = "main", fileName = "test451.kt", lineNumber = 10) +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at Test452Kt.main(test452.kt:10) test + +User code: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test452.Test452Kt", methodName = "main", fileName = "test452.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at Test453Kt.main(test453.kt:10) test + +User code: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test453.Test453Kt", methodName = "main", fileName = "test453.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at Test454Kt.main(test454.kt:10) test + +User code: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test454.Test454Kt", methodName = "main", fileName = "test454.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at Test455Kt.main(test455.kt:10) test + +User code: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test455.Test455Kt", methodName = "main", fileName = "test455.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at Test456Kt.main(test456.kt:10) test + +User code: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test456.Test456Kt", methodName = "main", fileName = "test456.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at Test457Kt.main(test457.kt:10) test + +User code: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test457.Test457Kt", methodName = "main", fileName = "test457.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test458Kt.main(test458.kt:10) test + +User code: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test458.Test458Kt", methodName = "main", fileName = "test458.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at Test459Kt.main(test459.kt:10) test + +User code: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test459.Test459Kt", methodName = "main", fileName = "test459.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test460Kt.main(test460.kt:10) test + +User code: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test460.Test460Kt", methodName = "main", fileName = "test460.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test461Kt.main(test461.kt:10) test + +User code: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test461.Test461Kt", methodName = "main", fileName = "test461.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at Test462Kt.main(test462.kt:10) test + +User code: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test462.Test462Kt", methodName = "main", fileName = "test462.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at Test463Kt.main(test463.kt:10) test + +User code: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test463.Test463Kt", methodName = "main", fileName = "test463.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at Test464Kt.main(test464.kt:10) test + +User code: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test464.Test464Kt", methodName = "main", fileName = "test464.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at Test465Kt.main(test465.kt:10) test + +User code: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test465.Test465Kt", methodName = "main", fileName = "test465.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at Test466Kt.main(test466.kt:10) test + +User code: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test466.Test466Kt", methodName = "main", fileName = "test466.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at Test467Kt.main(test467.kt:10) test + +User code: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test467.Test467Kt", methodName = "main", fileName = "test467.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at Test468Kt.main(test468.kt:10) test + +User code: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test468.Test468Kt", methodName = "main", fileName = "test468.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at Test469Kt.main(test469.kt:10) test + +User code: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test469.Test469Kt", methodName = "main", fileName = "test469.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at Test470Kt.main(test470.kt:10) test + +User code: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test470.Test470Kt", methodName = "main", fileName = "test470.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test471Kt.main(test471.kt:10) test + +User code: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test471.Test471Kt", methodName = "main", fileName = "test471.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at Test472Kt.main(test472.kt:10) test + +User code: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test472.Test472Kt", methodName = "main", fileName = "test472.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at Test473Kt.main(test473.kt:10) test + +User code: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test473.Test473Kt", methodName = "main", fileName = "test473.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test474Kt.main(test474.kt:10) test + +User code: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test474.Test474Kt", methodName = "main", fileName = "test474.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at Test475Kt.main(test475.kt:10) test + +User code: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test475.Test475Kt", methodName = "main", fileName = "test475.kt", lineNumber = 10) +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test476Kt.main(test476.kt:10) test + +User code: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test476.Test476Kt", methodName = "main", fileName = "test476.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test477Kt.main(test477.kt:10) test + +User code: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test477.Test477Kt", methodName = "main", fileName = "test477.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### info("info message {}", throwable) at Test481Kt.main(test481.kt:10) test + +User code: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test481.Test481Kt", methodName = "main", fileName = "test481.kt", lineNumber = 10) +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at Test482Kt.main(test482.kt:10) test + +User code: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test482.Test482Kt", methodName = "main", fileName = "test482.kt", lineNumber = 10) +} +``` + +### info(throwable) { "info messageBuilder $i" } at Test483Kt.main(test483.kt:10) test + +User code: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test483.Test483Kt", methodName = "main", fileName = "test483.kt", lineNumber = 10) +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at Test484Kt.main(test484.kt:10) test + +User code: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test484.Test484Kt", methodName = "main", fileName = "test484.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at Test485Kt.main(test485.kt:10) test + +User code: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test485.Test485Kt", methodName = "main", fileName = "test485.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at Test486Kt.main(test486.kt:10) test + +User code: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test486.Test486Kt", methodName = "main", fileName = "test486.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test487Kt.main(test487.kt:10) test + +User code: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test487.Test487Kt", methodName = "main", fileName = "test487.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at Test488Kt.main(test488.kt:10) test + +User code: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test488.Test488Kt", methodName = "main", fileName = "test488.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at Test489Kt.main(test489.kt:10) test + +User code: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test489.Test489Kt", methodName = "main", fileName = "test489.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test490Kt.main(test490.kt:10) test + +User code: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test490.Test490Kt", methodName = "main", fileName = "test490.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at Test491Kt.main(test491.kt:10) test + +User code: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test491.Test491Kt", methodName = "main", fileName = "test491.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test492Kt.main(test492.kt:10) test + +User code: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test492.Test492Kt", methodName = "main", fileName = "test492.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test493Kt.main(test493.kt:10) test + +User code: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test493.Test493Kt", methodName = "main", fileName = "test493.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at Test494Kt.main(test494.kt:10) test + +User code: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test494.Test494Kt", methodName = "main", fileName = "test494.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at Test495Kt.main(test495.kt:10) test + +User code: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test495.Test495Kt", methodName = "main", fileName = "test495.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at Test496Kt.main(test496.kt:10) test + +User code: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test496.Test496Kt", methodName = "main", fileName = "test496.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at Test497Kt.main(test497.kt:10) test + +User code: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test497.Test497Kt", methodName = "main", fileName = "test497.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at Test501Kt.main(test501.kt:10) test + +User code: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test501.Test501Kt", methodName = "main", fileName = "test501.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at Test502Kt.main(test502.kt:10) test + +User code: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test502.Test502Kt", methodName = "main", fileName = "test502.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test503Kt.main(test503.kt:10) test + +User code: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test503.Test503Kt", methodName = "main", fileName = "test503.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at Test504Kt.main(test504.kt:10) test + +User code: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test504.Test504Kt", methodName = "main", fileName = "test504.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at Test505Kt.main(test505.kt:10) test + +User code: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test505.Test505Kt", methodName = "main", fileName = "test505.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test506Kt.main(test506.kt:10) test + +User code: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test506.Test506Kt", methodName = "main", fileName = "test506.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at Test507Kt.main(test507.kt:10) test + +User code: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) +} +``` + +Transformed into: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test507.Test507Kt", methodName = "main", fileName = "test507.kt", lineNumber = 10) +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test508Kt.main(test508.kt:10) test + +User code: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test508.Test508Kt", methodName = "main", fileName = "test508.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test509Kt.main(test509.kt:10) test + +User code: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test509.Test509Kt", methodName = "main", fileName = "test509.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### info("info message {}") at Test513Kt.main(test513.kt:10) test + +User code: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") +} +``` + +Transformed into: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test513.Test513Kt", methodName = "main", fileName = "test513.kt", lineNumber = 10) +} +``` + +
+ +### info() { "info messageBuilder" } at Test514Kt.main(test514.kt:10) test + +User code: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test514.Test514Kt", methodName = "main", fileName = "test514.kt", lineNumber = 10) +} +``` + +### info() { "info messageBuilder $i" } at Test515Kt.main(test515.kt:10) test + +User code: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test515.Test515Kt", methodName = "main", fileName = "test515.kt", lineNumber = 10) +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at Test516Kt.main(test516.kt:10) test + +User code: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test516.Test516Kt", methodName = "main", fileName = "test516.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=null } at Test517Kt.main(test517.kt:10) test + +User code: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test517.Test517Kt", methodName = "main", fileName = "test517.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at Test518Kt.main(test518.kt:10) test + +User code: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test518.Test518Kt", methodName = "main", fileName = "test518.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at Test519Kt.main(test519.kt:10) test + +User code: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test519.Test519Kt", methodName = "main", fileName = "test519.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at Test520Kt.main(test520.kt:10) test + +User code: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test520.Test520Kt", methodName = "main", fileName = "test520.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at Test521Kt.main(test521.kt:10) test + +User code: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test521.Test521Kt", methodName = "main", fileName = "test521.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at Test522Kt.main(test522.kt:10) test + +User code: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test522.Test522Kt", methodName = "main", fileName = "test522.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at Test523Kt.main(test523.kt:10) test + +User code: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test523.Test523Kt", methodName = "main", fileName = "test523.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test524Kt.main(test524.kt:10) test + +User code: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test524.Test524Kt", methodName = "main", fileName = "test524.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test525Kt.main(test525.kt:10) test + +User code: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test525.Test525Kt", methodName = "main", fileName = "test525.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at Test526Kt.main(test526.kt:10) test + +User code: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test526.Test526Kt", methodName = "main", fileName = "test526.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at Test527Kt.main(test527.kt:10) test + +User code: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test527.Test527Kt", methodName = "main", fileName = "test527.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at Test528Kt.main(test528.kt:10) test + +User code: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test528.Test528Kt", methodName = "main", fileName = "test528.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at Test529Kt.main(test529.kt:10) test + +User code: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test529.Test529Kt", methodName = "main", fileName = "test529.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at Test530Kt.main(test530.kt:10) test + +User code: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test530.Test530Kt", methodName = "main", fileName = "test530.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at Test531Kt.main(test531.kt:10) test + +User code: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test531.Test531Kt", methodName = "main", fileName = "test531.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at Test532Kt.main(test532.kt:10) test + +User code: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test532.Test532Kt", methodName = "main", fileName = "test532.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at Test533Kt.main(test533.kt:10) test + +User code: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test533.Test533Kt", methodName = "main", fileName = "test533.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at Test534Kt.main(test534.kt:10) test + +User code: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test534.Test534Kt", methodName = "main", fileName = "test534.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test535Kt.main(test535.kt:10) test + +User code: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test535.Test535Kt", methodName = "main", fileName = "test535.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at Test536Kt.main(test536.kt:10) test + +User code: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test536.Test536Kt", methodName = "main", fileName = "test536.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at Test537Kt.main(test537.kt:10) test + +User code: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test537.Test537Kt", methodName = "main", fileName = "test537.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test538Kt.main(test538.kt:10) test + +User code: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test538.Test538Kt", methodName = "main", fileName = "test538.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at Test539Kt.main(test539.kt:10) test + +User code: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test539.Test539Kt", methodName = "main", fileName = "test539.kt", lineNumber = 10) +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test540Kt.main(test540.kt:10) test + +User code: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test540.Test540Kt", methodName = "main", fileName = "test540.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test541Kt.main(test541.kt:10) test + +User code: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test541.Test541Kt", methodName = "main", fileName = "test541.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}", throwable) at Test545Kt.main(test545.kt:10) test + +User code: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test545.Test545Kt", methodName = "main", fileName = "test545.kt", lineNumber = 10) +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at Test546Kt.main(test546.kt:10) test + +User code: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test546.Test546Kt", methodName = "main", fileName = "test546.kt", lineNumber = 10) +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at Test547Kt.main(test547.kt:10) test + +User code: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test547.Test547Kt", methodName = "main", fileName = "test547.kt", lineNumber = 10) +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at Test548Kt.main(test548.kt:10) test + +User code: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test548.Test548Kt", methodName = "main", fileName = "test548.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at Test549Kt.main(test549.kt:10) test + +User code: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test549.Test549Kt", methodName = "main", fileName = "test549.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at Test550Kt.main(test550.kt:10) test + +User code: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test550.Test550Kt", methodName = "main", fileName = "test550.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test551Kt.main(test551.kt:10) test + +User code: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test551.Test551Kt", methodName = "main", fileName = "test551.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at Test552Kt.main(test552.kt:10) test + +User code: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test552.Test552Kt", methodName = "main", fileName = "test552.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at Test553Kt.main(test553.kt:10) test + +User code: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test553.Test553Kt", methodName = "main", fileName = "test553.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test554Kt.main(test554.kt:10) test + +User code: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test554.Test554Kt", methodName = "main", fileName = "test554.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at Test555Kt.main(test555.kt:10) test + +User code: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test555.Test555Kt", methodName = "main", fileName = "test555.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test556Kt.main(test556.kt:10) test + +User code: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test556.Test556Kt", methodName = "main", fileName = "test556.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test557Kt.main(test557.kt:10) test + +User code: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test557.Test557Kt", methodName = "main", fileName = "test557.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at Test558Kt.main(test558.kt:10) test + +User code: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test558.Test558Kt", methodName = "main", fileName = "test558.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at Test559Kt.main(test559.kt:10) test + +User code: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test559.Test559Kt", methodName = "main", fileName = "test559.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at Test560Kt.main(test560.kt:10) test + +User code: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test560.Test560Kt", methodName = "main", fileName = "test560.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at Test561Kt.main(test561.kt:10) test + +User code: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test561.Test561Kt", methodName = "main", fileName = "test561.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at Test565Kt.main(test565.kt:10) test + +User code: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test565.Test565Kt", methodName = "main", fileName = "test565.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at Test566Kt.main(test566.kt:10) test + +User code: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test566.Test566Kt", methodName = "main", fileName = "test566.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test567Kt.main(test567.kt:10) test + +User code: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test567.Test567Kt", methodName = "main", fileName = "test567.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at Test568Kt.main(test568.kt:10) test + +User code: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test568.Test568Kt", methodName = "main", fileName = "test568.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at Test569Kt.main(test569.kt:10) test + +User code: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test569.Test569Kt", methodName = "main", fileName = "test569.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test570Kt.main(test570.kt:10) test + +User code: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test570.Test570Kt", methodName = "main", fileName = "test570.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at Test571Kt.main(test571.kt:10) test + +User code: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) +} +``` + +Transformed into: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test571.Test571Kt", methodName = "main", fileName = "test571.kt", lineNumber = 10) +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test572Kt.main(test572.kt:10) test + +User code: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test572.Test572Kt", methodName = "main", fileName = "test572.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test573Kt.main(test573.kt:10) test + +User code: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test573.Test573Kt", methodName = "main", fileName = "test573.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}") at Test577Kt.main(test577.kt:10) test + +User code: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") +} +``` + +Transformed into: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test577.Test577Kt", methodName = "main", fileName = "test577.kt", lineNumber = 10) +} +``` + +
+ +### warn() { "warn messageBuilder" } at Test578Kt.main(test578.kt:10) test + +User code: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test578.Test578Kt", methodName = "main", fileName = "test578.kt", lineNumber = 10) +} +``` + +### warn() { "warn messageBuilder $i" } at Test579Kt.main(test579.kt:10) test + +User code: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test579.Test579Kt", methodName = "main", fileName = "test579.kt", lineNumber = 10) +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at Test580Kt.main(test580.kt:10) test + +User code: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test580.Test580Kt", methodName = "main", fileName = "test580.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at Test581Kt.main(test581.kt:10) test + +User code: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test581.Test581Kt", methodName = "main", fileName = "test581.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at Test582Kt.main(test582.kt:10) test + +User code: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test582.Test582Kt", methodName = "main", fileName = "test582.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at Test583Kt.main(test583.kt:10) test + +User code: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test583.Test583Kt", methodName = "main", fileName = "test583.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at Test584Kt.main(test584.kt:10) test + +User code: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test584.Test584Kt", methodName = "main", fileName = "test584.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at Test585Kt.main(test585.kt:10) test + +User code: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test585.Test585Kt", methodName = "main", fileName = "test585.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test586Kt.main(test586.kt:10) test + +User code: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test586.Test586Kt", methodName = "main", fileName = "test586.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at Test587Kt.main(test587.kt:10) test + +User code: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test587.Test587Kt", methodName = "main", fileName = "test587.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test588Kt.main(test588.kt:10) test + +User code: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test588.Test588Kt", methodName = "main", fileName = "test588.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test589Kt.main(test589.kt:10) test + +User code: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test589.Test589Kt", methodName = "main", fileName = "test589.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at Test590Kt.main(test590.kt:10) test + +User code: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test590.Test590Kt", methodName = "main", fileName = "test590.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at Test591Kt.main(test591.kt:10) test + +User code: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test591.Test591Kt", methodName = "main", fileName = "test591.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at Test592Kt.main(test592.kt:10) test + +User code: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test592.Test592Kt", methodName = "main", fileName = "test592.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at Test593Kt.main(test593.kt:10) test + +User code: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test593.Test593Kt", methodName = "main", fileName = "test593.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at Test594Kt.main(test594.kt:10) test + +User code: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test594.Test594Kt", methodName = "main", fileName = "test594.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at Test595Kt.main(test595.kt:10) test + +User code: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test595.Test595Kt", methodName = "main", fileName = "test595.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at Test596Kt.main(test596.kt:10) test + +User code: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test596.Test596Kt", methodName = "main", fileName = "test596.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at Test597Kt.main(test597.kt:10) test + +User code: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test597.Test597Kt", methodName = "main", fileName = "test597.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at Test598Kt.main(test598.kt:10) test + +User code: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test598.Test598Kt", methodName = "main", fileName = "test598.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test599Kt.main(test599.kt:10) test + +User code: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test599.Test599Kt", methodName = "main", fileName = "test599.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at Test600Kt.main(test600.kt:10) test + +User code: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test600.Test600Kt", methodName = "main", fileName = "test600.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at Test601Kt.main(test601.kt:10) test + +User code: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test601.Test601Kt", methodName = "main", fileName = "test601.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test602Kt.main(test602.kt:10) test + +User code: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test602.Test602Kt", methodName = "main", fileName = "test602.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at Test603Kt.main(test603.kt:10) test + +User code: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test603.Test603Kt", methodName = "main", fileName = "test603.kt", lineNumber = 10) +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test604Kt.main(test604.kt:10) test + +User code: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test604.Test604Kt", methodName = "main", fileName = "test604.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test605Kt.main(test605.kt:10) test + +User code: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test605.Test605Kt", methodName = "main", fileName = "test605.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### error("error message {}", throwable) at Test609Kt.main(test609.kt:10) test + +User code: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test609.Test609Kt", methodName = "main", fileName = "test609.kt", lineNumber = 10) +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at Test610Kt.main(test610.kt:10) test + +User code: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test610.Test610Kt", methodName = "main", fileName = "test610.kt", lineNumber = 10) +} +``` + +### error(throwable) { "error messageBuilder $i" } at Test611Kt.main(test611.kt:10) test + +User code: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test611.Test611Kt", methodName = "main", fileName = "test611.kt", lineNumber = 10) +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at Test612Kt.main(test612.kt:10) test + +User code: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test612.Test612Kt", methodName = "main", fileName = "test612.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=throwable } at Test613Kt.main(test613.kt:10) test + +User code: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test613.Test613Kt", methodName = "main", fileName = "test613.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at Test614Kt.main(test614.kt:10) test + +User code: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test614.Test614Kt", methodName = "main", fileName = "test614.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test615Kt.main(test615.kt:10) test + +User code: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test615.Test615Kt", methodName = "main", fileName = "test615.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at Test616Kt.main(test616.kt:10) test + +User code: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test616.Test616Kt", methodName = "main", fileName = "test616.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at Test617Kt.main(test617.kt:10) test + +User code: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test617.Test617Kt", methodName = "main", fileName = "test617.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test618Kt.main(test618.kt:10) test + +User code: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test618.Test618Kt", methodName = "main", fileName = "test618.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at Test619Kt.main(test619.kt:10) test + +User code: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test619.Test619Kt", methodName = "main", fileName = "test619.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test620Kt.main(test620.kt:10) test + +User code: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test620.Test620Kt", methodName = "main", fileName = "test620.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test621Kt.main(test621.kt:10) test + +User code: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test621.Test621Kt", methodName = "main", fileName = "test621.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at Test622Kt.main(test622.kt:10) test + +User code: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test622.Test622Kt", methodName = "main", fileName = "test622.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at Test623Kt.main(test623.kt:10) test + +User code: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test623.Test623Kt", methodName = "main", fileName = "test623.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at Test624Kt.main(test624.kt:10) test + +User code: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test624.Test624Kt", methodName = "main", fileName = "test624.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at Test625Kt.main(test625.kt:10) test + +User code: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test625.Test625Kt", methodName = "main", fileName = "test625.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at Test629Kt.main(test629.kt:10) test + +User code: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test629.Test629Kt", methodName = "main", fileName = "test629.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at Test630Kt.main(test630.kt:10) test + +User code: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test630.Test630Kt", methodName = "main", fileName = "test630.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test631Kt.main(test631.kt:10) test + +User code: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test631.Test631Kt", methodName = "main", fileName = "test631.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at Test632Kt.main(test632.kt:10) test + +User code: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test632.Test632Kt", methodName = "main", fileName = "test632.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at Test633Kt.main(test633.kt:10) test + +User code: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test633.Test633Kt", methodName = "main", fileName = "test633.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test634Kt.main(test634.kt:10) test + +User code: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test634.Test634Kt", methodName = "main", fileName = "test634.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at Test635Kt.main(test635.kt:10) test + +User code: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) +} +``` + +Transformed into: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test635.Test635Kt", methodName = "main", fileName = "test635.kt", lineNumber = 10) +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test636Kt.main(test636.kt:10) test + +User code: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test636.Test636Kt", methodName = "main", fileName = "test636.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test637Kt.main(test637.kt:10) test + +User code: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test637.Test637Kt", methodName = "main", fileName = "test637.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### error("error message {}") at Test641Kt.main(test641.kt:10) test + +User code: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") +} +``` + +Transformed into: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test641.Test641Kt", methodName = "main", fileName = "test641.kt", lineNumber = 10) +} +``` + +
+ +### error() { "error messageBuilder" } at Test642Kt.main(test642.kt:10) test + +User code: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test642.Test642Kt", methodName = "main", fileName = "test642.kt", lineNumber = 10) +} +``` + +### error() { "error messageBuilder $i" } at Test643Kt.main(test643.kt:10) test + +User code: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test643.Test643Kt", methodName = "main", fileName = "test643.kt", lineNumber = 10) +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at Test644Kt.main(test644.kt:10) test + +User code: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test644.Test644Kt", methodName = "main", fileName = "test644.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=null } at Test645Kt.main(test645.kt:10) test + +User code: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test645.Test645Kt", methodName = "main", fileName = "test645.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at Test646Kt.main(test646.kt:10) test + +User code: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test646.Test646Kt", methodName = "main", fileName = "test646.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at Test647Kt.main(test647.kt:10) test + +User code: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test647.Test647Kt", methodName = "main", fileName = "test647.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at Test648Kt.main(test648.kt:10) test + +User code: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test648.Test648Kt", methodName = "main", fileName = "test648.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at Test649Kt.main(test649.kt:10) test + +User code: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test649.Test649Kt", methodName = "main", fileName = "test649.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at Test650Kt.main(test650.kt:10) test + +User code: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test650.Test650Kt", methodName = "main", fileName = "test650.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
+ +
featureFlag=DISABLE_TRANSFORMING_THROWING_CATCHING_API + +
with class=true + +
entry/exit API + +### entry(argument1, argument2) at MainTest.main(test1.kt:10) test + +User code: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) + } + +} +``` + +Transformed into: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entryWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "entry(argument1, argument2)", className = "test1.MainTest", methodName = "main", fileName = "test1.kt", lineNumber = 10)) + } + +} +``` + +### exit(resultValue) at MainTest.main(test2.kt:10) test + +User code: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) + } + +} +``` + +Transformed into: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "exit(resultValue)", className = "test2.MainTest", methodName = "main", fileName = "test2.kt", lineNumber = 10)) + } + +} +``` + +### exit() at MainTest.main(test3.kt:10) test + +User code: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() + } + +} +``` + +Transformed into: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(className = "test3.MainTest", methodName = "main", fileName = "test3.kt", lineNumber = 10)) + } + +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at MainTest.main(test4.kt:10) test + +User code: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) + } + +} +``` + +### catching(throwable) at MainTest.main(test5.kt:10) test + +User code: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) + } + +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at MainTest.main(test6.kt:10) test + +User code: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test6.MainTest", methodName = "main", fileName = "test6.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test7.kt:10) test + +User code: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test7.MainTest", methodName = "main", fileName = "test7.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test8.kt:10) test + +User code: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test8.MainTest", methodName = "main", fileName = "test8.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at MainTest.main(test9.kt:10) test + +User code: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test9.MainTest", methodName = "main", fileName = "test9.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at MainTest.main(test10.kt:10) test + +User code: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test10.MainTest", methodName = "main", fileName = "test10.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test11.kt:10) test + +User code: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test11.MainTest", methodName = "main", fileName = "test11.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at MainTest.main(test12.kt:10) test + +User code: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test12.MainTest", methodName = "main", fileName = "test12.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at MainTest.main(test13.kt:10) test + +User code: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test13.MainTest", methodName = "main", fileName = "test13.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at MainTest.main(test14.kt:10) test + +User code: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test14.MainTest", methodName = "main", fileName = "test14.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test15.kt:10) test + +User code: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test15.MainTest", methodName = "main", fileName = "test15.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test16.kt:10) test + +User code: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test16.MainTest", methodName = "main", fileName = "test16.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test17.kt:10) test + +User code: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test17.MainTest", methodName = "main", fileName = "test17.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test18.kt:10) test + +User code: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test18.MainTest", methodName = "main", fileName = "test18.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test19.kt:10) test + +User code: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test19.MainTest", methodName = "main", fileName = "test19.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test20.kt:10) test + +User code: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test20.MainTest", methodName = "main", fileName = "test20.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test21.kt:10) test + +User code: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test21.MainTest", methodName = "main", fileName = "test21.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at MainTest.main(test22.kt:10) test + +User code: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test22.MainTest", methodName = "main", fileName = "test22.kt", lineNumber = 10) + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test23.kt:10) test + +User code: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test23.MainTest", methodName = "main", fileName = "test23.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test24.kt:10) test + +User code: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test24.MainTest", methodName = "main", fileName = "test24.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}", throwable) at MainTest.main(test28.kt:10) test + +User code: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test28.MainTest", methodName = "main", fileName = "test28.kt", lineNumber = 10) + } + +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at MainTest.main(test29.kt:10) test + +User code: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test29.MainTest", methodName = "main", fileName = "test29.kt", lineNumber = 10) + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at MainTest.main(test30.kt:10) test + +User code: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test30.MainTest", methodName = "main", fileName = "test30.kt", lineNumber = 10) + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test31.kt:10) test + +User code: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test31.MainTest", methodName = "main", fileName = "test31.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at MainTest.main(test32.kt:10) test + +User code: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test32.MainTest", methodName = "main", fileName = "test32.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test33.kt:10) test + +User code: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test33.MainTest", methodName = "main", fileName = "test33.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test34.kt:10) test + +User code: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test34.MainTest", methodName = "main", fileName = "test34.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test35.kt:10) test + +User code: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test35.MainTest", methodName = "main", fileName = "test35.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test36.kt:10) test + +User code: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test36.MainTest", methodName = "main", fileName = "test36.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test37.kt:10) test + +User code: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test37.MainTest", methodName = "main", fileName = "test37.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at MainTest.main(test38.kt:10) test + +User code: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test38.MainTest", methodName = "main", fileName = "test38.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test39.kt:10) test + +User code: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test39.MainTest", methodName = "main", fileName = "test39.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test40.kt:10) test + +User code: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test40.MainTest", methodName = "main", fileName = "test40.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at MainTest.main(test41.kt:10) test + +User code: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test41.MainTest", methodName = "main", fileName = "test41.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at MainTest.main(test42.kt:10) test + +User code: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test42.MainTest", methodName = "main", fileName = "test42.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test43.kt:10) test + +User code: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test43.MainTest", methodName = "main", fileName = "test43.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at MainTest.main(test44.kt:10) test + +User code: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test44.MainTest", methodName = "main", fileName = "test44.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test48.kt:10) test + +User code: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test48.MainTest", methodName = "main", fileName = "test48.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test49.kt:10) test + +User code: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test49.MainTest", methodName = "main", fileName = "test49.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test50.kt:10) test + +User code: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test50.MainTest", methodName = "main", fileName = "test50.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test51.kt:10) test + +User code: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test51.MainTest", methodName = "main", fileName = "test51.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test52.kt:10) test + +User code: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test52.MainTest", methodName = "main", fileName = "test52.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test53.kt:10) test + +User code: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test53.MainTest", methodName = "main", fileName = "test53.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at MainTest.main(test54.kt:10) test + +User code: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test54.MainTest", methodName = "main", fileName = "test54.kt", lineNumber = 10) + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test55.kt:10) test + +User code: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test55.MainTest", methodName = "main", fileName = "test55.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test56.kt:10) test + +User code: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test56.MainTest", methodName = "main", fileName = "test56.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}") at MainTest.main(test60.kt:10) test + +User code: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") + } + +} +``` + +Transformed into: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test60.MainTest", methodName = "main", fileName = "test60.kt", lineNumber = 10) + } + +} +``` + +
+ +### trace() { "trace messageBuilder" } at MainTest.main(test61.kt:10) test + +User code: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test61.MainTest", methodName = "main", fileName = "test61.kt", lineNumber = 10) + } + +} +``` + +### trace() { "trace messageBuilder $i" } at MainTest.main(test62.kt:10) test + +User code: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test62.MainTest", methodName = "main", fileName = "test62.kt", lineNumber = 10) + } + +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at MainTest.main(test63.kt:10) test + +User code: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test63.MainTest", methodName = "main", fileName = "test63.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at MainTest.main(test64.kt:10) test + +User code: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test64.MainTest", methodName = "main", fileName = "test64.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at MainTest.main(test65.kt:10) test + +User code: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test65.MainTest", methodName = "main", fileName = "test65.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test66.kt:10) test + +User code: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test66.MainTest", methodName = "main", fileName = "test66.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at MainTest.main(test67.kt:10) test + +User code: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test67.MainTest", methodName = "main", fileName = "test67.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test68.kt:10) test + +User code: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test68.MainTest", methodName = "main", fileName = "test68.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test69.kt:10) test + +User code: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test69.MainTest", methodName = "main", fileName = "test69.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at MainTest.main(test70.kt:10) test + +User code: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test70.MainTest", methodName = "main", fileName = "test70.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test71.kt:10) test + +User code: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test71.MainTest", methodName = "main", fileName = "test71.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test72.kt:10) test + +User code: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test72.MainTest", methodName = "main", fileName = "test72.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at MainTest.main(test73.kt:10) test + +User code: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test73.MainTest", methodName = "main", fileName = "test73.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at MainTest.main(test74.kt:10) test + +User code: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test74.MainTest", methodName = "main", fileName = "test74.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test75.kt:10) test + +User code: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test75.MainTest", methodName = "main", fileName = "test75.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at MainTest.main(test76.kt:10) test + +User code: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test76.MainTest", methodName = "main", fileName = "test76.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at MainTest.main(test77.kt:10) test + +User code: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test77.MainTest", methodName = "main", fileName = "test77.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at MainTest.main(test78.kt:10) test + +User code: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test78.MainTest", methodName = "main", fileName = "test78.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test79.kt:10) test + +User code: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test79.MainTest", methodName = "main", fileName = "test79.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test80.kt:10) test + +User code: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test80.MainTest", methodName = "main", fileName = "test80.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test81.kt:10) test + +User code: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test81.MainTest", methodName = "main", fileName = "test81.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test82.kt:10) test + +User code: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test82.MainTest", methodName = "main", fileName = "test82.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test83.kt:10) test + +User code: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test83.MainTest", methodName = "main", fileName = "test83.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test84.kt:10) test + +User code: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test84.MainTest", methodName = "main", fileName = "test84.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test85.kt:10) test + +User code: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test85.MainTest", methodName = "main", fileName = "test85.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at MainTest.main(test86.kt:10) test + +User code: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test86.MainTest", methodName = "main", fileName = "test86.kt", lineNumber = 10) + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test87.kt:10) test + +User code: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test87.MainTest", methodName = "main", fileName = "test87.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test88.kt:10) test + +User code: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test88.MainTest", methodName = "main", fileName = "test88.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}", throwable) at MainTest.main(test92.kt:10) test + +User code: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test92.MainTest", methodName = "main", fileName = "test92.kt", lineNumber = 10) + } + +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at MainTest.main(test93.kt:10) test + +User code: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test93.MainTest", methodName = "main", fileName = "test93.kt", lineNumber = 10) + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at MainTest.main(test94.kt:10) test + +User code: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test94.MainTest", methodName = "main", fileName = "test94.kt", lineNumber = 10) + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test95.kt:10) test + +User code: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test95.MainTest", methodName = "main", fileName = "test95.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at MainTest.main(test96.kt:10) test + +User code: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test96.MainTest", methodName = "main", fileName = "test96.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test97.kt:10) test + +User code: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test97.MainTest", methodName = "main", fileName = "test97.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test98.kt:10) test + +User code: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test98.MainTest", methodName = "main", fileName = "test98.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test99.kt:10) test + +User code: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test99.MainTest", methodName = "main", fileName = "test99.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test100.kt:10) test + +User code: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test100.MainTest", methodName = "main", fileName = "test100.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test101.kt:10) test + +User code: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test101.MainTest", methodName = "main", fileName = "test101.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at MainTest.main(test102.kt:10) test + +User code: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test102.MainTest", methodName = "main", fileName = "test102.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test103.kt:10) test + +User code: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test103.MainTest", methodName = "main", fileName = "test103.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test104.kt:10) test + +User code: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test104.MainTest", methodName = "main", fileName = "test104.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at MainTest.main(test105.kt:10) test + +User code: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test105.MainTest", methodName = "main", fileName = "test105.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at MainTest.main(test106.kt:10) test + +User code: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test106.MainTest", methodName = "main", fileName = "test106.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test107.kt:10) test + +User code: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test107.MainTest", methodName = "main", fileName = "test107.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at MainTest.main(test108.kt:10) test + +User code: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test108.MainTest", methodName = "main", fileName = "test108.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test112.kt:10) test + +User code: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test112.MainTest", methodName = "main", fileName = "test112.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test113.kt:10) test + +User code: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test113.MainTest", methodName = "main", fileName = "test113.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test114.kt:10) test + +User code: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test114.MainTest", methodName = "main", fileName = "test114.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test115.kt:10) test + +User code: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test115.MainTest", methodName = "main", fileName = "test115.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test116.kt:10) test + +User code: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test116.MainTest", methodName = "main", fileName = "test116.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test117.kt:10) test + +User code: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test117.MainTest", methodName = "main", fileName = "test117.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at MainTest.main(test118.kt:10) test + +User code: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test118.MainTest", methodName = "main", fileName = "test118.kt", lineNumber = 10) + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test119.kt:10) test + +User code: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test119.MainTest", methodName = "main", fileName = "test119.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test120.kt:10) test + +User code: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test120.MainTest", methodName = "main", fileName = "test120.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}") at MainTest.main(test124.kt:10) test + +User code: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") + } + +} +``` + +Transformed into: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test124.MainTest", methodName = "main", fileName = "test124.kt", lineNumber = 10) + } + +} +``` + +
+ +### debug() { "debug messageBuilder" } at MainTest.main(test125.kt:10) test + +User code: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test125.MainTest", methodName = "main", fileName = "test125.kt", lineNumber = 10) + } + +} +``` + +### debug() { "debug messageBuilder $i" } at MainTest.main(test126.kt:10) test + +User code: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test126.MainTest", methodName = "main", fileName = "test126.kt", lineNumber = 10) + } + +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at MainTest.main(test127.kt:10) test + +User code: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test127.MainTest", methodName = "main", fileName = "test127.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at MainTest.main(test128.kt:10) test + +User code: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test128.MainTest", methodName = "main", fileName = "test128.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at MainTest.main(test129.kt:10) test + +User code: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test129.MainTest", methodName = "main", fileName = "test129.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test130.kt:10) test + +User code: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test130.MainTest", methodName = "main", fileName = "test130.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at MainTest.main(test131.kt:10) test + +User code: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test131.MainTest", methodName = "main", fileName = "test131.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test132.kt:10) test + +User code: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test132.MainTest", methodName = "main", fileName = "test132.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test133.kt:10) test + +User code: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test133.MainTest", methodName = "main", fileName = "test133.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at MainTest.main(test134.kt:10) test + +User code: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test134.MainTest", methodName = "main", fileName = "test134.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test135.kt:10) test + +User code: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test135.MainTest", methodName = "main", fileName = "test135.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test136.kt:10) test + +User code: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test136.MainTest", methodName = "main", fileName = "test136.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at MainTest.main(test137.kt:10) test + +User code: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test137.MainTest", methodName = "main", fileName = "test137.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at MainTest.main(test138.kt:10) test + +User code: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test138.MainTest", methodName = "main", fileName = "test138.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test139.kt:10) test + +User code: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test139.MainTest", methodName = "main", fileName = "test139.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at MainTest.main(test140.kt:10) test + +User code: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test140.MainTest", methodName = "main", fileName = "test140.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at MainTest.main(test141.kt:10) test + +User code: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test141.MainTest", methodName = "main", fileName = "test141.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at MainTest.main(test142.kt:10) test + +User code: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test142.MainTest", methodName = "main", fileName = "test142.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test143.kt:10) test + +User code: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test143.MainTest", methodName = "main", fileName = "test143.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test144.kt:10) test + +User code: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test144.MainTest", methodName = "main", fileName = "test144.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test145.kt:10) test + +User code: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test145.MainTest", methodName = "main", fileName = "test145.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test146.kt:10) test + +User code: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test146.MainTest", methodName = "main", fileName = "test146.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test147.kt:10) test + +User code: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test147.MainTest", methodName = "main", fileName = "test147.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test148.kt:10) test + +User code: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test148.MainTest", methodName = "main", fileName = "test148.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test149.kt:10) test + +User code: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test149.MainTest", methodName = "main", fileName = "test149.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at MainTest.main(test150.kt:10) test + +User code: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test150.MainTest", methodName = "main", fileName = "test150.kt", lineNumber = 10) + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test151.kt:10) test + +User code: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test151.MainTest", methodName = "main", fileName = "test151.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test152.kt:10) test + +User code: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test152.MainTest", methodName = "main", fileName = "test152.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}", throwable) at MainTest.main(test156.kt:10) test + +User code: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test156.MainTest", methodName = "main", fileName = "test156.kt", lineNumber = 10) + } + +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at MainTest.main(test157.kt:10) test + +User code: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test157.MainTest", methodName = "main", fileName = "test157.kt", lineNumber = 10) + } + +} +``` + +### info(throwable) { "info messageBuilder $i" } at MainTest.main(test158.kt:10) test + +User code: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test158.MainTest", methodName = "main", fileName = "test158.kt", lineNumber = 10) + } + +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test159.kt:10) test + +User code: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test159.MainTest", methodName = "main", fileName = "test159.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at MainTest.main(test160.kt:10) test + +User code: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test160.MainTest", methodName = "main", fileName = "test160.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test161.kt:10) test + +User code: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test161.MainTest", methodName = "main", fileName = "test161.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test162.kt:10) test + +User code: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test162.MainTest", methodName = "main", fileName = "test162.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at MainTest.main(test163.kt:10) test + +User code: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test163.MainTest", methodName = "main", fileName = "test163.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test164.kt:10) test + +User code: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test164.MainTest", methodName = "main", fileName = "test164.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test165.kt:10) test + +User code: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test165.MainTest", methodName = "main", fileName = "test165.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at MainTest.main(test166.kt:10) test + +User code: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test166.MainTest", methodName = "main", fileName = "test166.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test167.kt:10) test + +User code: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test167.MainTest", methodName = "main", fileName = "test167.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test168.kt:10) test + +User code: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test168.MainTest", methodName = "main", fileName = "test168.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at MainTest.main(test169.kt:10) test + +User code: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test169.MainTest", methodName = "main", fileName = "test169.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at MainTest.main(test170.kt:10) test + +User code: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test170.MainTest", methodName = "main", fileName = "test170.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test171.kt:10) test + +User code: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test171.MainTest", methodName = "main", fileName = "test171.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at MainTest.main(test172.kt:10) test + +User code: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test172.MainTest", methodName = "main", fileName = "test172.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at MainTest.main(test176.kt:10) test + +User code: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test176.MainTest", methodName = "main", fileName = "test176.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test177.kt:10) test + +User code: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test177.MainTest", methodName = "main", fileName = "test177.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test178.kt:10) test + +User code: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test178.MainTest", methodName = "main", fileName = "test178.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at MainTest.main(test179.kt:10) test + +User code: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test179.MainTest", methodName = "main", fileName = "test179.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test180.kt:10) test + +User code: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test180.MainTest", methodName = "main", fileName = "test180.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test181.kt:10) test + +User code: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test181.MainTest", methodName = "main", fileName = "test181.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at MainTest.main(test182.kt:10) test + +User code: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test182.MainTest", methodName = "main", fileName = "test182.kt", lineNumber = 10) + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test183.kt:10) test + +User code: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test183.MainTest", methodName = "main", fileName = "test183.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test184.kt:10) test + +User code: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test184.MainTest", methodName = "main", fileName = "test184.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}") at MainTest.main(test188.kt:10) test + +User code: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") + } + +} +``` + +Transformed into: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test188.MainTest", methodName = "main", fileName = "test188.kt", lineNumber = 10) + } + +} +``` + +
+ +### info() { "info messageBuilder" } at MainTest.main(test189.kt:10) test + +User code: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test189.MainTest", methodName = "main", fileName = "test189.kt", lineNumber = 10) + } + +} +``` + +### info() { "info messageBuilder $i" } at MainTest.main(test190.kt:10) test + +User code: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test190.MainTest", methodName = "main", fileName = "test190.kt", lineNumber = 10) + } + +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at MainTest.main(test191.kt:10) test + +User code: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test191.MainTest", methodName = "main", fileName = "test191.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=null } at MainTest.main(test192.kt:10) test + +User code: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test192.MainTest", methodName = "main", fileName = "test192.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at MainTest.main(test193.kt:10) test + +User code: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test193.MainTest", methodName = "main", fileName = "test193.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test194.kt:10) test + +User code: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test194.MainTest", methodName = "main", fileName = "test194.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at MainTest.main(test195.kt:10) test + +User code: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test195.MainTest", methodName = "main", fileName = "test195.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at MainTest.main(test196.kt:10) test + +User code: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test196.MainTest", methodName = "main", fileName = "test196.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test197.kt:10) test + +User code: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test197.MainTest", methodName = "main", fileName = "test197.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at MainTest.main(test198.kt:10) test + +User code: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test198.MainTest", methodName = "main", fileName = "test198.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test199.kt:10) test + +User code: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test199.MainTest", methodName = "main", fileName = "test199.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test200.kt:10) test + +User code: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test200.MainTest", methodName = "main", fileName = "test200.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at MainTest.main(test201.kt:10) test + +User code: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test201.MainTest", methodName = "main", fileName = "test201.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at MainTest.main(test202.kt:10) test + +User code: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test202.MainTest", methodName = "main", fileName = "test202.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test203.kt:10) test + +User code: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test203.MainTest", methodName = "main", fileName = "test203.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at MainTest.main(test204.kt:10) test + +User code: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test204.MainTest", methodName = "main", fileName = "test204.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at MainTest.main(test205.kt:10) test + +User code: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test205.MainTest", methodName = "main", fileName = "test205.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at MainTest.main(test206.kt:10) test + +User code: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test206.MainTest", methodName = "main", fileName = "test206.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test207.kt:10) test + +User code: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test207.MainTest", methodName = "main", fileName = "test207.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test208.kt:10) test + +User code: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test208.MainTest", methodName = "main", fileName = "test208.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test209.kt:10) test + +User code: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test209.MainTest", methodName = "main", fileName = "test209.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test210.kt:10) test + +User code: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test210.MainTest", methodName = "main", fileName = "test210.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test211.kt:10) test + +User code: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test211.MainTest", methodName = "main", fileName = "test211.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test212.kt:10) test + +User code: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test212.MainTest", methodName = "main", fileName = "test212.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test213.kt:10) test + +User code: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test213.MainTest", methodName = "main", fileName = "test213.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at MainTest.main(test214.kt:10) test + +User code: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test214.MainTest", methodName = "main", fileName = "test214.kt", lineNumber = 10) + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test215.kt:10) test + +User code: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test215.MainTest", methodName = "main", fileName = "test215.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test216.kt:10) test + +User code: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test216.MainTest", methodName = "main", fileName = "test216.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}", throwable) at MainTest.main(test220.kt:10) test + +User code: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test220.MainTest", methodName = "main", fileName = "test220.kt", lineNumber = 10) + } + +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at MainTest.main(test221.kt:10) test + +User code: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test221.MainTest", methodName = "main", fileName = "test221.kt", lineNumber = 10) + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at MainTest.main(test222.kt:10) test + +User code: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test222.MainTest", methodName = "main", fileName = "test222.kt", lineNumber = 10) + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test223.kt:10) test + +User code: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test223.MainTest", methodName = "main", fileName = "test223.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at MainTest.main(test224.kt:10) test + +User code: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test224.MainTest", methodName = "main", fileName = "test224.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test225.kt:10) test + +User code: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test225.MainTest", methodName = "main", fileName = "test225.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test226.kt:10) test + +User code: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test226.MainTest", methodName = "main", fileName = "test226.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test227.kt:10) test + +User code: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test227.MainTest", methodName = "main", fileName = "test227.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test228.kt:10) test + +User code: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test228.MainTest", methodName = "main", fileName = "test228.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test229.kt:10) test + +User code: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test229.MainTest", methodName = "main", fileName = "test229.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at MainTest.main(test230.kt:10) test + +User code: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test230.MainTest", methodName = "main", fileName = "test230.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test231.kt:10) test + +User code: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test231.MainTest", methodName = "main", fileName = "test231.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test232.kt:10) test + +User code: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test232.MainTest", methodName = "main", fileName = "test232.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at MainTest.main(test233.kt:10) test + +User code: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test233.MainTest", methodName = "main", fileName = "test233.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at MainTest.main(test234.kt:10) test + +User code: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test234.MainTest", methodName = "main", fileName = "test234.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test235.kt:10) test + +User code: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test235.MainTest", methodName = "main", fileName = "test235.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at MainTest.main(test236.kt:10) test + +User code: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test236.MainTest", methodName = "main", fileName = "test236.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test240.kt:10) test + +User code: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test240.MainTest", methodName = "main", fileName = "test240.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test241.kt:10) test + +User code: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test241.MainTest", methodName = "main", fileName = "test241.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test242.kt:10) test + +User code: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test242.MainTest", methodName = "main", fileName = "test242.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test243.kt:10) test + +User code: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test243.MainTest", methodName = "main", fileName = "test243.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test244.kt:10) test + +User code: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test244.MainTest", methodName = "main", fileName = "test244.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test245.kt:10) test + +User code: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test245.MainTest", methodName = "main", fileName = "test245.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at MainTest.main(test246.kt:10) test + +User code: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test246.MainTest", methodName = "main", fileName = "test246.kt", lineNumber = 10) + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test247.kt:10) test + +User code: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test247.MainTest", methodName = "main", fileName = "test247.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test248.kt:10) test + +User code: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test248.MainTest", methodName = "main", fileName = "test248.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}") at MainTest.main(test252.kt:10) test + +User code: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") + } + +} +``` + +Transformed into: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test252.MainTest", methodName = "main", fileName = "test252.kt", lineNumber = 10) + } + +} +``` + +
+ +### warn() { "warn messageBuilder" } at MainTest.main(test253.kt:10) test + +User code: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test253.MainTest", methodName = "main", fileName = "test253.kt", lineNumber = 10) + } + +} +``` + +### warn() { "warn messageBuilder $i" } at MainTest.main(test254.kt:10) test + +User code: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test254.MainTest", methodName = "main", fileName = "test254.kt", lineNumber = 10) + } + +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at MainTest.main(test255.kt:10) test + +User code: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test255.MainTest", methodName = "main", fileName = "test255.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at MainTest.main(test256.kt:10) test + +User code: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test256.MainTest", methodName = "main", fileName = "test256.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at MainTest.main(test257.kt:10) test + +User code: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test257.MainTest", methodName = "main", fileName = "test257.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test258.kt:10) test + +User code: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test258.MainTest", methodName = "main", fileName = "test258.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at MainTest.main(test259.kt:10) test + +User code: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test259.MainTest", methodName = "main", fileName = "test259.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test260.kt:10) test + +User code: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test260.MainTest", methodName = "main", fileName = "test260.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test261.kt:10) test + +User code: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test261.MainTest", methodName = "main", fileName = "test261.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at MainTest.main(test262.kt:10) test + +User code: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test262.MainTest", methodName = "main", fileName = "test262.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test263.kt:10) test + +User code: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test263.MainTest", methodName = "main", fileName = "test263.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test264.kt:10) test + +User code: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test264.MainTest", methodName = "main", fileName = "test264.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at MainTest.main(test265.kt:10) test + +User code: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test265.MainTest", methodName = "main", fileName = "test265.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at MainTest.main(test266.kt:10) test + +User code: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test266.MainTest", methodName = "main", fileName = "test266.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test267.kt:10) test + +User code: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test267.MainTest", methodName = "main", fileName = "test267.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at MainTest.main(test268.kt:10) test + +User code: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test268.MainTest", methodName = "main", fileName = "test268.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at MainTest.main(test269.kt:10) test + +User code: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test269.MainTest", methodName = "main", fileName = "test269.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at MainTest.main(test270.kt:10) test + +User code: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test270.MainTest", methodName = "main", fileName = "test270.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test271.kt:10) test + +User code: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test271.MainTest", methodName = "main", fileName = "test271.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test272.kt:10) test + +User code: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test272.MainTest", methodName = "main", fileName = "test272.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test273.kt:10) test + +User code: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test273.MainTest", methodName = "main", fileName = "test273.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test274.kt:10) test + +User code: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test274.MainTest", methodName = "main", fileName = "test274.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test275.kt:10) test + +User code: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test275.MainTest", methodName = "main", fileName = "test275.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test276.kt:10) test + +User code: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test276.MainTest", methodName = "main", fileName = "test276.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test277.kt:10) test + +User code: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test277.MainTest", methodName = "main", fileName = "test277.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at MainTest.main(test278.kt:10) test + +User code: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test278.MainTest", methodName = "main", fileName = "test278.kt", lineNumber = 10) + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test279.kt:10) test + +User code: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test279.MainTest", methodName = "main", fileName = "test279.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test280.kt:10) test + +User code: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test280.MainTest", methodName = "main", fileName = "test280.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}", throwable) at MainTest.main(test284.kt:10) test + +User code: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test284.MainTest", methodName = "main", fileName = "test284.kt", lineNumber = 10) + } + +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at MainTest.main(test285.kt:10) test + +User code: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test285.MainTest", methodName = "main", fileName = "test285.kt", lineNumber = 10) + } + +} +``` + +### error(throwable) { "error messageBuilder $i" } at MainTest.main(test286.kt:10) test + +User code: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test286.MainTest", methodName = "main", fileName = "test286.kt", lineNumber = 10) + } + +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test287.kt:10) test + +User code: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test287.MainTest", methodName = "main", fileName = "test287.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=throwable } at MainTest.main(test288.kt:10) test + +User code: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test288.MainTest", methodName = "main", fileName = "test288.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test289.kt:10) test + +User code: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test289.MainTest", methodName = "main", fileName = "test289.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test290.kt:10) test + +User code: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test290.MainTest", methodName = "main", fileName = "test290.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at MainTest.main(test291.kt:10) test + +User code: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test291.MainTest", methodName = "main", fileName = "test291.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test292.kt:10) test + +User code: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test292.MainTest", methodName = "main", fileName = "test292.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test293.kt:10) test + +User code: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test293.MainTest", methodName = "main", fileName = "test293.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at MainTest.main(test294.kt:10) test + +User code: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test294.MainTest", methodName = "main", fileName = "test294.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test295.kt:10) test + +User code: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test295.MainTest", methodName = "main", fileName = "test295.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test296.kt:10) test + +User code: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test296.MainTest", methodName = "main", fileName = "test296.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at MainTest.main(test297.kt:10) test + +User code: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test297.MainTest", methodName = "main", fileName = "test297.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at MainTest.main(test298.kt:10) test + +User code: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test298.MainTest", methodName = "main", fileName = "test298.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test299.kt:10) test + +User code: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test299.MainTest", methodName = "main", fileName = "test299.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at MainTest.main(test300.kt:10) test + +User code: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test300.MainTest", methodName = "main", fileName = "test300.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at MainTest.main(test304.kt:10) test + +User code: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test304.MainTest", methodName = "main", fileName = "test304.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test305.kt:10) test + +User code: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test305.MainTest", methodName = "main", fileName = "test305.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test306.kt:10) test + +User code: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test306.MainTest", methodName = "main", fileName = "test306.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at MainTest.main(test307.kt:10) test + +User code: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test307.MainTest", methodName = "main", fileName = "test307.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test308.kt:10) test + +User code: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test308.MainTest", methodName = "main", fileName = "test308.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test309.kt:10) test + +User code: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test309.MainTest", methodName = "main", fileName = "test309.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at MainTest.main(test310.kt:10) test + +User code: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test310.MainTest", methodName = "main", fileName = "test310.kt", lineNumber = 10) + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test311.kt:10) test + +User code: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test311.MainTest", methodName = "main", fileName = "test311.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test312.kt:10) test + +User code: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test312.MainTest", methodName = "main", fileName = "test312.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}") at MainTest.main(test316.kt:10) test + +User code: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") + } + +} +``` + +Transformed into: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test316.MainTest", methodName = "main", fileName = "test316.kt", lineNumber = 10) + } + +} +``` + +
+ +### error() { "error messageBuilder" } at MainTest.main(test317.kt:10) test + +User code: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test317.MainTest", methodName = "main", fileName = "test317.kt", lineNumber = 10) + } + +} +``` + +### error() { "error messageBuilder $i" } at MainTest.main(test318.kt:10) test + +User code: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test318.MainTest", methodName = "main", fileName = "test318.kt", lineNumber = 10) + } + +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at MainTest.main(test319.kt:10) test + +User code: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test319.MainTest", methodName = "main", fileName = "test319.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=null } at MainTest.main(test320.kt:10) test + +User code: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test320.MainTest", methodName = "main", fileName = "test320.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at MainTest.main(test321.kt:10) test + +User code: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test321.MainTest", methodName = "main", fileName = "test321.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test322.kt:10) test + +User code: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test322.MainTest", methodName = "main", fileName = "test322.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at MainTest.main(test323.kt:10) test + +User code: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test323.MainTest", methodName = "main", fileName = "test323.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at MainTest.main(test324.kt:10) test + +User code: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test324.MainTest", methodName = "main", fileName = "test324.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test325.kt:10) test + +User code: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test325.MainTest", methodName = "main", fileName = "test325.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
+ +
with class=false + +
entry/exit API + +### entry(argument1, argument2) at Test326Kt.main(test326.kt:10) test + +User code: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) +} +``` + +Transformed into: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entryWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "entry(argument1, argument2)", className = "test326.Test326Kt", methodName = "main", fileName = "test326.kt", lineNumber = 10)) +} +``` + +### exit(resultValue) at Test327Kt.main(test327.kt:10) test + +User code: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) +} +``` + +Transformed into: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "exit(resultValue)", className = "test327.Test327Kt", methodName = "main", fileName = "test327.kt", lineNumber = 10)) +} +``` + +### exit() at Test328Kt.main(test328.kt:10) test + +User code: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() +} +``` + +Transformed into: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(className = "test328.Test328Kt", methodName = "main", fileName = "test328.kt", lineNumber = 10)) +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at Test329Kt.main(test329.kt:10) test + +User code: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) +} +``` + +Remains as-is: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) +} +``` + +### catching(throwable) at Test330Kt.main(test330.kt:10) test + +User code: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) +} +``` + +Remains as-is: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at Test331Kt.main(test331.kt:10) test + +User code: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test331.Test331Kt", methodName = "main", fileName = "test331.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test332Kt.main(test332.kt:10) test + +User code: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test332.Test332Kt", methodName = "main", fileName = "test332.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test333Kt.main(test333.kt:10) test + +User code: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test333.Test333Kt", methodName = "main", fileName = "test333.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at Test334Kt.main(test334.kt:10) test + +User code: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test334.Test334Kt", methodName = "main", fileName = "test334.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at Test335Kt.main(test335.kt:10) test + +User code: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test335.Test335Kt", methodName = "main", fileName = "test335.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at Test336Kt.main(test336.kt:10) test + +User code: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test336.Test336Kt", methodName = "main", fileName = "test336.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at Test337Kt.main(test337.kt:10) test + +User code: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test337.Test337Kt", methodName = "main", fileName = "test337.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at Test338Kt.main(test338.kt:10) test + +User code: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test338.Test338Kt", methodName = "main", fileName = "test338.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at Test339Kt.main(test339.kt:10) test + +User code: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test339.Test339Kt", methodName = "main", fileName = "test339.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at Test340Kt.main(test340.kt:10) test + +User code: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test340.Test340Kt", methodName = "main", fileName = "test340.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at Test341Kt.main(test341.kt:10) test + +User code: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test341.Test341Kt", methodName = "main", fileName = "test341.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at Test342Kt.main(test342.kt:10) test + +User code: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test342.Test342Kt", methodName = "main", fileName = "test342.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test343Kt.main(test343.kt:10) test + +User code: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test343.Test343Kt", methodName = "main", fileName = "test343.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at Test344Kt.main(test344.kt:10) test + +User code: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test344.Test344Kt", methodName = "main", fileName = "test344.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at Test345Kt.main(test345.kt:10) test + +User code: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test345.Test345Kt", methodName = "main", fileName = "test345.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test346Kt.main(test346.kt:10) test + +User code: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test346.Test346Kt", methodName = "main", fileName = "test346.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at Test347Kt.main(test347.kt:10) test + +User code: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test347.Test347Kt", methodName = "main", fileName = "test347.kt", lineNumber = 10) +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test348Kt.main(test348.kt:10) test + +User code: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test348.Test348Kt", methodName = "main", fileName = "test348.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test349Kt.main(test349.kt:10) test + +User code: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test349.Test349Kt", methodName = "main", fileName = "test349.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}", throwable) at Test353Kt.main(test353.kt:10) test + +User code: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test353.Test353Kt", methodName = "main", fileName = "test353.kt", lineNumber = 10) +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at Test354Kt.main(test354.kt:10) test + +User code: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test354.Test354Kt", methodName = "main", fileName = "test354.kt", lineNumber = 10) +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at Test355Kt.main(test355.kt:10) test + +User code: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test355.Test355Kt", methodName = "main", fileName = "test355.kt", lineNumber = 10) +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at Test356Kt.main(test356.kt:10) test + +User code: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test356.Test356Kt", methodName = "main", fileName = "test356.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at Test357Kt.main(test357.kt:10) test + +User code: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test357.Test357Kt", methodName = "main", fileName = "test357.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at Test358Kt.main(test358.kt:10) test + +User code: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test358.Test358Kt", methodName = "main", fileName = "test358.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test359Kt.main(test359.kt:10) test + +User code: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test359.Test359Kt", methodName = "main", fileName = "test359.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at Test360Kt.main(test360.kt:10) test + +User code: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test360.Test360Kt", methodName = "main", fileName = "test360.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at Test361Kt.main(test361.kt:10) test + +User code: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test361.Test361Kt", methodName = "main", fileName = "test361.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test362Kt.main(test362.kt:10) test + +User code: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test362.Test362Kt", methodName = "main", fileName = "test362.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at Test363Kt.main(test363.kt:10) test + +User code: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test363.Test363Kt", methodName = "main", fileName = "test363.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test364Kt.main(test364.kt:10) test + +User code: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test364.Test364Kt", methodName = "main", fileName = "test364.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test365Kt.main(test365.kt:10) test + +User code: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test365.Test365Kt", methodName = "main", fileName = "test365.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at Test366Kt.main(test366.kt:10) test + +User code: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test366.Test366Kt", methodName = "main", fileName = "test366.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at Test367Kt.main(test367.kt:10) test + +User code: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test367.Test367Kt", methodName = "main", fileName = "test367.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at Test368Kt.main(test368.kt:10) test + +User code: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test368.Test368Kt", methodName = "main", fileName = "test368.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at Test369Kt.main(test369.kt:10) test + +User code: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test369.Test369Kt", methodName = "main", fileName = "test369.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at Test373Kt.main(test373.kt:10) test + +User code: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test373.Test373Kt", methodName = "main", fileName = "test373.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at Test374Kt.main(test374.kt:10) test + +User code: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test374.Test374Kt", methodName = "main", fileName = "test374.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test375Kt.main(test375.kt:10) test + +User code: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test375.Test375Kt", methodName = "main", fileName = "test375.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at Test376Kt.main(test376.kt:10) test + +User code: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test376.Test376Kt", methodName = "main", fileName = "test376.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at Test377Kt.main(test377.kt:10) test + +User code: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test377.Test377Kt", methodName = "main", fileName = "test377.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test378Kt.main(test378.kt:10) test + +User code: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test378.Test378Kt", methodName = "main", fileName = "test378.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at Test379Kt.main(test379.kt:10) test + +User code: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) +} +``` + +Transformed into: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test379.Test379Kt", methodName = "main", fileName = "test379.kt", lineNumber = 10) +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test380Kt.main(test380.kt:10) test + +User code: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test380.Test380Kt", methodName = "main", fileName = "test380.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test381Kt.main(test381.kt:10) test + +User code: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test381.Test381Kt", methodName = "main", fileName = "test381.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}") at Test385Kt.main(test385.kt:10) test + +User code: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") +} +``` + +Transformed into: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test385.Test385Kt", methodName = "main", fileName = "test385.kt", lineNumber = 10) +} +``` + +
+ +### trace() { "trace messageBuilder" } at Test386Kt.main(test386.kt:10) test + +User code: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test386.Test386Kt", methodName = "main", fileName = "test386.kt", lineNumber = 10) +} +``` + +### trace() { "trace messageBuilder $i" } at Test387Kt.main(test387.kt:10) test + +User code: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test387.Test387Kt", methodName = "main", fileName = "test387.kt", lineNumber = 10) +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at Test388Kt.main(test388.kt:10) test + +User code: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test388.Test388Kt", methodName = "main", fileName = "test388.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at Test389Kt.main(test389.kt:10) test + +User code: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test389.Test389Kt", methodName = "main", fileName = "test389.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at Test390Kt.main(test390.kt:10) test + +User code: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test390.Test390Kt", methodName = "main", fileName = "test390.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at Test391Kt.main(test391.kt:10) test + +User code: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test391.Test391Kt", methodName = "main", fileName = "test391.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at Test392Kt.main(test392.kt:10) test + +User code: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test392.Test392Kt", methodName = "main", fileName = "test392.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at Test393Kt.main(test393.kt:10) test + +User code: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test393.Test393Kt", methodName = "main", fileName = "test393.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test394Kt.main(test394.kt:10) test + +User code: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test394.Test394Kt", methodName = "main", fileName = "test394.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at Test395Kt.main(test395.kt:10) test + +User code: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test395.Test395Kt", methodName = "main", fileName = "test395.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test396Kt.main(test396.kt:10) test + +User code: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test396.Test396Kt", methodName = "main", fileName = "test396.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test397Kt.main(test397.kt:10) test + +User code: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test397.Test397Kt", methodName = "main", fileName = "test397.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at Test398Kt.main(test398.kt:10) test + +User code: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test398.Test398Kt", methodName = "main", fileName = "test398.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at Test399Kt.main(test399.kt:10) test + +User code: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test399.Test399Kt", methodName = "main", fileName = "test399.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at Test400Kt.main(test400.kt:10) test + +User code: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test400.Test400Kt", methodName = "main", fileName = "test400.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at Test401Kt.main(test401.kt:10) test + +User code: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test401.Test401Kt", methodName = "main", fileName = "test401.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at Test402Kt.main(test402.kt:10) test + +User code: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test402.Test402Kt", methodName = "main", fileName = "test402.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at Test403Kt.main(test403.kt:10) test + +User code: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test403.Test403Kt", methodName = "main", fileName = "test403.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at Test404Kt.main(test404.kt:10) test + +User code: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test404.Test404Kt", methodName = "main", fileName = "test404.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at Test405Kt.main(test405.kt:10) test + +User code: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test405.Test405Kt", methodName = "main", fileName = "test405.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at Test406Kt.main(test406.kt:10) test + +User code: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test406.Test406Kt", methodName = "main", fileName = "test406.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test407Kt.main(test407.kt:10) test + +User code: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test407.Test407Kt", methodName = "main", fileName = "test407.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at Test408Kt.main(test408.kt:10) test + +User code: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test408.Test408Kt", methodName = "main", fileName = "test408.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at Test409Kt.main(test409.kt:10) test + +User code: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test409.Test409Kt", methodName = "main", fileName = "test409.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test410Kt.main(test410.kt:10) test + +User code: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test410.Test410Kt", methodName = "main", fileName = "test410.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at Test411Kt.main(test411.kt:10) test + +User code: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test411.Test411Kt", methodName = "main", fileName = "test411.kt", lineNumber = 10) +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test412Kt.main(test412.kt:10) test + +User code: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test412.Test412Kt", methodName = "main", fileName = "test412.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test413Kt.main(test413.kt:10) test + +User code: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test413.Test413Kt", methodName = "main", fileName = "test413.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}", throwable) at Test417Kt.main(test417.kt:10) test + +User code: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test417.Test417Kt", methodName = "main", fileName = "test417.kt", lineNumber = 10) +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at Test418Kt.main(test418.kt:10) test + +User code: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test418.Test418Kt", methodName = "main", fileName = "test418.kt", lineNumber = 10) +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at Test419Kt.main(test419.kt:10) test + +User code: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test419.Test419Kt", methodName = "main", fileName = "test419.kt", lineNumber = 10) +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at Test420Kt.main(test420.kt:10) test + +User code: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test420.Test420Kt", methodName = "main", fileName = "test420.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at Test421Kt.main(test421.kt:10) test + +User code: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test421.Test421Kt", methodName = "main", fileName = "test421.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at Test422Kt.main(test422.kt:10) test + +User code: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test422.Test422Kt", methodName = "main", fileName = "test422.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test423Kt.main(test423.kt:10) test + +User code: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test423.Test423Kt", methodName = "main", fileName = "test423.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at Test424Kt.main(test424.kt:10) test + +User code: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test424.Test424Kt", methodName = "main", fileName = "test424.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at Test425Kt.main(test425.kt:10) test + +User code: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test425.Test425Kt", methodName = "main", fileName = "test425.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test426Kt.main(test426.kt:10) test + +User code: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test426.Test426Kt", methodName = "main", fileName = "test426.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at Test427Kt.main(test427.kt:10) test + +User code: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test427.Test427Kt", methodName = "main", fileName = "test427.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test428Kt.main(test428.kt:10) test + +User code: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test428.Test428Kt", methodName = "main", fileName = "test428.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test429Kt.main(test429.kt:10) test + +User code: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test429.Test429Kt", methodName = "main", fileName = "test429.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at Test430Kt.main(test430.kt:10) test + +User code: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test430.Test430Kt", methodName = "main", fileName = "test430.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at Test431Kt.main(test431.kt:10) test + +User code: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test431.Test431Kt", methodName = "main", fileName = "test431.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at Test432Kt.main(test432.kt:10) test + +User code: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test432.Test432Kt", methodName = "main", fileName = "test432.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at Test433Kt.main(test433.kt:10) test + +User code: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test433.Test433Kt", methodName = "main", fileName = "test433.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at Test437Kt.main(test437.kt:10) test + +User code: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test437.Test437Kt", methodName = "main", fileName = "test437.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at Test438Kt.main(test438.kt:10) test + +User code: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test438.Test438Kt", methodName = "main", fileName = "test438.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test439Kt.main(test439.kt:10) test + +User code: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test439.Test439Kt", methodName = "main", fileName = "test439.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at Test440Kt.main(test440.kt:10) test + +User code: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test440.Test440Kt", methodName = "main", fileName = "test440.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at Test441Kt.main(test441.kt:10) test + +User code: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test441.Test441Kt", methodName = "main", fileName = "test441.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test442Kt.main(test442.kt:10) test + +User code: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test442.Test442Kt", methodName = "main", fileName = "test442.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at Test443Kt.main(test443.kt:10) test + +User code: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) +} +``` + +Transformed into: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test443.Test443Kt", methodName = "main", fileName = "test443.kt", lineNumber = 10) +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test444Kt.main(test444.kt:10) test + +User code: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test444.Test444Kt", methodName = "main", fileName = "test444.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test445Kt.main(test445.kt:10) test + +User code: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test445.Test445Kt", methodName = "main", fileName = "test445.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}") at Test449Kt.main(test449.kt:10) test + +User code: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") +} +``` + +Transformed into: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test449.Test449Kt", methodName = "main", fileName = "test449.kt", lineNumber = 10) +} +``` + +
+ +### debug() { "debug messageBuilder" } at Test450Kt.main(test450.kt:10) test + +User code: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test450.Test450Kt", methodName = "main", fileName = "test450.kt", lineNumber = 10) +} +``` + +### debug() { "debug messageBuilder $i" } at Test451Kt.main(test451.kt:10) test + +User code: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test451.Test451Kt", methodName = "main", fileName = "test451.kt", lineNumber = 10) +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at Test452Kt.main(test452.kt:10) test + +User code: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test452.Test452Kt", methodName = "main", fileName = "test452.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at Test453Kt.main(test453.kt:10) test + +User code: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test453.Test453Kt", methodName = "main", fileName = "test453.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at Test454Kt.main(test454.kt:10) test + +User code: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test454.Test454Kt", methodName = "main", fileName = "test454.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at Test455Kt.main(test455.kt:10) test + +User code: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test455.Test455Kt", methodName = "main", fileName = "test455.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at Test456Kt.main(test456.kt:10) test + +User code: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test456.Test456Kt", methodName = "main", fileName = "test456.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at Test457Kt.main(test457.kt:10) test + +User code: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test457.Test457Kt", methodName = "main", fileName = "test457.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test458Kt.main(test458.kt:10) test + +User code: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test458.Test458Kt", methodName = "main", fileName = "test458.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at Test459Kt.main(test459.kt:10) test + +User code: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test459.Test459Kt", methodName = "main", fileName = "test459.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test460Kt.main(test460.kt:10) test + +User code: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test460.Test460Kt", methodName = "main", fileName = "test460.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test461Kt.main(test461.kt:10) test + +User code: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test461.Test461Kt", methodName = "main", fileName = "test461.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at Test462Kt.main(test462.kt:10) test + +User code: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test462.Test462Kt", methodName = "main", fileName = "test462.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at Test463Kt.main(test463.kt:10) test + +User code: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test463.Test463Kt", methodName = "main", fileName = "test463.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at Test464Kt.main(test464.kt:10) test + +User code: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test464.Test464Kt", methodName = "main", fileName = "test464.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at Test465Kt.main(test465.kt:10) test + +User code: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test465.Test465Kt", methodName = "main", fileName = "test465.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at Test466Kt.main(test466.kt:10) test + +User code: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test466.Test466Kt", methodName = "main", fileName = "test466.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at Test467Kt.main(test467.kt:10) test + +User code: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test467.Test467Kt", methodName = "main", fileName = "test467.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at Test468Kt.main(test468.kt:10) test + +User code: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test468.Test468Kt", methodName = "main", fileName = "test468.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at Test469Kt.main(test469.kt:10) test + +User code: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test469.Test469Kt", methodName = "main", fileName = "test469.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at Test470Kt.main(test470.kt:10) test + +User code: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test470.Test470Kt", methodName = "main", fileName = "test470.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test471Kt.main(test471.kt:10) test + +User code: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test471.Test471Kt", methodName = "main", fileName = "test471.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at Test472Kt.main(test472.kt:10) test + +User code: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test472.Test472Kt", methodName = "main", fileName = "test472.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at Test473Kt.main(test473.kt:10) test + +User code: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test473.Test473Kt", methodName = "main", fileName = "test473.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test474Kt.main(test474.kt:10) test + +User code: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test474.Test474Kt", methodName = "main", fileName = "test474.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at Test475Kt.main(test475.kt:10) test + +User code: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test475.Test475Kt", methodName = "main", fileName = "test475.kt", lineNumber = 10) +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test476Kt.main(test476.kt:10) test + +User code: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test476.Test476Kt", methodName = "main", fileName = "test476.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test477Kt.main(test477.kt:10) test + +User code: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test477.Test477Kt", methodName = "main", fileName = "test477.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### info("info message {}", throwable) at Test481Kt.main(test481.kt:10) test + +User code: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test481.Test481Kt", methodName = "main", fileName = "test481.kt", lineNumber = 10) +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at Test482Kt.main(test482.kt:10) test + +User code: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test482.Test482Kt", methodName = "main", fileName = "test482.kt", lineNumber = 10) +} +``` + +### info(throwable) { "info messageBuilder $i" } at Test483Kt.main(test483.kt:10) test + +User code: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test483.Test483Kt", methodName = "main", fileName = "test483.kt", lineNumber = 10) +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at Test484Kt.main(test484.kt:10) test + +User code: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test484.Test484Kt", methodName = "main", fileName = "test484.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at Test485Kt.main(test485.kt:10) test + +User code: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test485.Test485Kt", methodName = "main", fileName = "test485.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at Test486Kt.main(test486.kt:10) test + +User code: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test486.Test486Kt", methodName = "main", fileName = "test486.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test487Kt.main(test487.kt:10) test + +User code: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test487.Test487Kt", methodName = "main", fileName = "test487.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at Test488Kt.main(test488.kt:10) test + +User code: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test488.Test488Kt", methodName = "main", fileName = "test488.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at Test489Kt.main(test489.kt:10) test + +User code: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test489.Test489Kt", methodName = "main", fileName = "test489.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test490Kt.main(test490.kt:10) test + +User code: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test490.Test490Kt", methodName = "main", fileName = "test490.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at Test491Kt.main(test491.kt:10) test + +User code: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test491.Test491Kt", methodName = "main", fileName = "test491.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test492Kt.main(test492.kt:10) test + +User code: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test492.Test492Kt", methodName = "main", fileName = "test492.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test493Kt.main(test493.kt:10) test + +User code: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test493.Test493Kt", methodName = "main", fileName = "test493.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at Test494Kt.main(test494.kt:10) test + +User code: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test494.Test494Kt", methodName = "main", fileName = "test494.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at Test495Kt.main(test495.kt:10) test + +User code: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test495.Test495Kt", methodName = "main", fileName = "test495.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at Test496Kt.main(test496.kt:10) test + +User code: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test496.Test496Kt", methodName = "main", fileName = "test496.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at Test497Kt.main(test497.kt:10) test + +User code: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test497.Test497Kt", methodName = "main", fileName = "test497.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at Test501Kt.main(test501.kt:10) test + +User code: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test501.Test501Kt", methodName = "main", fileName = "test501.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at Test502Kt.main(test502.kt:10) test + +User code: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test502.Test502Kt", methodName = "main", fileName = "test502.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test503Kt.main(test503.kt:10) test + +User code: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test503.Test503Kt", methodName = "main", fileName = "test503.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at Test504Kt.main(test504.kt:10) test + +User code: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test504.Test504Kt", methodName = "main", fileName = "test504.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at Test505Kt.main(test505.kt:10) test + +User code: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test505.Test505Kt", methodName = "main", fileName = "test505.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test506Kt.main(test506.kt:10) test + +User code: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test506.Test506Kt", methodName = "main", fileName = "test506.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at Test507Kt.main(test507.kt:10) test + +User code: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) +} +``` + +Transformed into: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test507.Test507Kt", methodName = "main", fileName = "test507.kt", lineNumber = 10) +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test508Kt.main(test508.kt:10) test + +User code: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test508.Test508Kt", methodName = "main", fileName = "test508.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test509Kt.main(test509.kt:10) test + +User code: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test509.Test509Kt", methodName = "main", fileName = "test509.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### info("info message {}") at Test513Kt.main(test513.kt:10) test + +User code: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") +} +``` + +Transformed into: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test513.Test513Kt", methodName = "main", fileName = "test513.kt", lineNumber = 10) +} +``` + +
+ +### info() { "info messageBuilder" } at Test514Kt.main(test514.kt:10) test + +User code: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test514.Test514Kt", methodName = "main", fileName = "test514.kt", lineNumber = 10) +} +``` + +### info() { "info messageBuilder $i" } at Test515Kt.main(test515.kt:10) test + +User code: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test515.Test515Kt", methodName = "main", fileName = "test515.kt", lineNumber = 10) +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at Test516Kt.main(test516.kt:10) test + +User code: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test516.Test516Kt", methodName = "main", fileName = "test516.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=null } at Test517Kt.main(test517.kt:10) test + +User code: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test517.Test517Kt", methodName = "main", fileName = "test517.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at Test518Kt.main(test518.kt:10) test + +User code: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test518.Test518Kt", methodName = "main", fileName = "test518.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at Test519Kt.main(test519.kt:10) test + +User code: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test519.Test519Kt", methodName = "main", fileName = "test519.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at Test520Kt.main(test520.kt:10) test + +User code: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test520.Test520Kt", methodName = "main", fileName = "test520.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at Test521Kt.main(test521.kt:10) test + +User code: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test521.Test521Kt", methodName = "main", fileName = "test521.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at Test522Kt.main(test522.kt:10) test + +User code: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test522.Test522Kt", methodName = "main", fileName = "test522.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at Test523Kt.main(test523.kt:10) test + +User code: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test523.Test523Kt", methodName = "main", fileName = "test523.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test524Kt.main(test524.kt:10) test + +User code: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test524.Test524Kt", methodName = "main", fileName = "test524.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test525Kt.main(test525.kt:10) test + +User code: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test525.Test525Kt", methodName = "main", fileName = "test525.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at Test526Kt.main(test526.kt:10) test + +User code: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test526.Test526Kt", methodName = "main", fileName = "test526.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at Test527Kt.main(test527.kt:10) test + +User code: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test527.Test527Kt", methodName = "main", fileName = "test527.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at Test528Kt.main(test528.kt:10) test + +User code: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test528.Test528Kt", methodName = "main", fileName = "test528.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at Test529Kt.main(test529.kt:10) test + +User code: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test529.Test529Kt", methodName = "main", fileName = "test529.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at Test530Kt.main(test530.kt:10) test + +User code: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test530.Test530Kt", methodName = "main", fileName = "test530.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at Test531Kt.main(test531.kt:10) test + +User code: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test531.Test531Kt", methodName = "main", fileName = "test531.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at Test532Kt.main(test532.kt:10) test + +User code: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test532.Test532Kt", methodName = "main", fileName = "test532.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at Test533Kt.main(test533.kt:10) test + +User code: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test533.Test533Kt", methodName = "main", fileName = "test533.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at Test534Kt.main(test534.kt:10) test + +User code: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test534.Test534Kt", methodName = "main", fileName = "test534.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test535Kt.main(test535.kt:10) test + +User code: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test535.Test535Kt", methodName = "main", fileName = "test535.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at Test536Kt.main(test536.kt:10) test + +User code: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test536.Test536Kt", methodName = "main", fileName = "test536.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at Test537Kt.main(test537.kt:10) test + +User code: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test537.Test537Kt", methodName = "main", fileName = "test537.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test538Kt.main(test538.kt:10) test + +User code: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test538.Test538Kt", methodName = "main", fileName = "test538.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at Test539Kt.main(test539.kt:10) test + +User code: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test539.Test539Kt", methodName = "main", fileName = "test539.kt", lineNumber = 10) +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test540Kt.main(test540.kt:10) test + +User code: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test540.Test540Kt", methodName = "main", fileName = "test540.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test541Kt.main(test541.kt:10) test + +User code: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test541.Test541Kt", methodName = "main", fileName = "test541.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}", throwable) at Test545Kt.main(test545.kt:10) test + +User code: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test545.Test545Kt", methodName = "main", fileName = "test545.kt", lineNumber = 10) +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at Test546Kt.main(test546.kt:10) test + +User code: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test546.Test546Kt", methodName = "main", fileName = "test546.kt", lineNumber = 10) +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at Test547Kt.main(test547.kt:10) test + +User code: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test547.Test547Kt", methodName = "main", fileName = "test547.kt", lineNumber = 10) +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at Test548Kt.main(test548.kt:10) test + +User code: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test548.Test548Kt", methodName = "main", fileName = "test548.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at Test549Kt.main(test549.kt:10) test + +User code: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test549.Test549Kt", methodName = "main", fileName = "test549.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at Test550Kt.main(test550.kt:10) test + +User code: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test550.Test550Kt", methodName = "main", fileName = "test550.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test551Kt.main(test551.kt:10) test + +User code: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test551.Test551Kt", methodName = "main", fileName = "test551.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at Test552Kt.main(test552.kt:10) test + +User code: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test552.Test552Kt", methodName = "main", fileName = "test552.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at Test553Kt.main(test553.kt:10) test + +User code: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test553.Test553Kt", methodName = "main", fileName = "test553.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test554Kt.main(test554.kt:10) test + +User code: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test554.Test554Kt", methodName = "main", fileName = "test554.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at Test555Kt.main(test555.kt:10) test + +User code: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test555.Test555Kt", methodName = "main", fileName = "test555.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test556Kt.main(test556.kt:10) test + +User code: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test556.Test556Kt", methodName = "main", fileName = "test556.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test557Kt.main(test557.kt:10) test + +User code: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test557.Test557Kt", methodName = "main", fileName = "test557.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at Test558Kt.main(test558.kt:10) test + +User code: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test558.Test558Kt", methodName = "main", fileName = "test558.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at Test559Kt.main(test559.kt:10) test + +User code: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test559.Test559Kt", methodName = "main", fileName = "test559.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at Test560Kt.main(test560.kt:10) test + +User code: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test560.Test560Kt", methodName = "main", fileName = "test560.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at Test561Kt.main(test561.kt:10) test + +User code: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test561.Test561Kt", methodName = "main", fileName = "test561.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at Test565Kt.main(test565.kt:10) test + +User code: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test565.Test565Kt", methodName = "main", fileName = "test565.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at Test566Kt.main(test566.kt:10) test + +User code: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test566.Test566Kt", methodName = "main", fileName = "test566.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test567Kt.main(test567.kt:10) test + +User code: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test567.Test567Kt", methodName = "main", fileName = "test567.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at Test568Kt.main(test568.kt:10) test + +User code: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test568.Test568Kt", methodName = "main", fileName = "test568.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at Test569Kt.main(test569.kt:10) test + +User code: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test569.Test569Kt", methodName = "main", fileName = "test569.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test570Kt.main(test570.kt:10) test + +User code: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test570.Test570Kt", methodName = "main", fileName = "test570.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at Test571Kt.main(test571.kt:10) test + +User code: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) +} +``` + +Transformed into: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test571.Test571Kt", methodName = "main", fileName = "test571.kt", lineNumber = 10) +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test572Kt.main(test572.kt:10) test + +User code: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test572.Test572Kt", methodName = "main", fileName = "test572.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test573Kt.main(test573.kt:10) test + +User code: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test573.Test573Kt", methodName = "main", fileName = "test573.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}") at Test577Kt.main(test577.kt:10) test + +User code: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") +} +``` + +Transformed into: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test577.Test577Kt", methodName = "main", fileName = "test577.kt", lineNumber = 10) +} +``` + +
+ +### warn() { "warn messageBuilder" } at Test578Kt.main(test578.kt:10) test + +User code: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test578.Test578Kt", methodName = "main", fileName = "test578.kt", lineNumber = 10) +} +``` + +### warn() { "warn messageBuilder $i" } at Test579Kt.main(test579.kt:10) test + +User code: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test579.Test579Kt", methodName = "main", fileName = "test579.kt", lineNumber = 10) +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at Test580Kt.main(test580.kt:10) test + +User code: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test580.Test580Kt", methodName = "main", fileName = "test580.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at Test581Kt.main(test581.kt:10) test + +User code: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test581.Test581Kt", methodName = "main", fileName = "test581.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at Test582Kt.main(test582.kt:10) test + +User code: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test582.Test582Kt", methodName = "main", fileName = "test582.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at Test583Kt.main(test583.kt:10) test + +User code: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test583.Test583Kt", methodName = "main", fileName = "test583.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at Test584Kt.main(test584.kt:10) test + +User code: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test584.Test584Kt", methodName = "main", fileName = "test584.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at Test585Kt.main(test585.kt:10) test + +User code: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test585.Test585Kt", methodName = "main", fileName = "test585.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test586Kt.main(test586.kt:10) test + +User code: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test586.Test586Kt", methodName = "main", fileName = "test586.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at Test587Kt.main(test587.kt:10) test + +User code: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test587.Test587Kt", methodName = "main", fileName = "test587.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test588Kt.main(test588.kt:10) test + +User code: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test588.Test588Kt", methodName = "main", fileName = "test588.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test589Kt.main(test589.kt:10) test + +User code: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test589.Test589Kt", methodName = "main", fileName = "test589.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at Test590Kt.main(test590.kt:10) test + +User code: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test590.Test590Kt", methodName = "main", fileName = "test590.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at Test591Kt.main(test591.kt:10) test + +User code: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test591.Test591Kt", methodName = "main", fileName = "test591.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at Test592Kt.main(test592.kt:10) test + +User code: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test592.Test592Kt", methodName = "main", fileName = "test592.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at Test593Kt.main(test593.kt:10) test + +User code: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test593.Test593Kt", methodName = "main", fileName = "test593.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at Test594Kt.main(test594.kt:10) test + +User code: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test594.Test594Kt", methodName = "main", fileName = "test594.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at Test595Kt.main(test595.kt:10) test + +User code: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test595.Test595Kt", methodName = "main", fileName = "test595.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at Test596Kt.main(test596.kt:10) test + +User code: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test596.Test596Kt", methodName = "main", fileName = "test596.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at Test597Kt.main(test597.kt:10) test + +User code: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test597.Test597Kt", methodName = "main", fileName = "test597.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at Test598Kt.main(test598.kt:10) test + +User code: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test598.Test598Kt", methodName = "main", fileName = "test598.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test599Kt.main(test599.kt:10) test + +User code: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test599.Test599Kt", methodName = "main", fileName = "test599.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at Test600Kt.main(test600.kt:10) test + +User code: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test600.Test600Kt", methodName = "main", fileName = "test600.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at Test601Kt.main(test601.kt:10) test + +User code: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test601.Test601Kt", methodName = "main", fileName = "test601.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test602Kt.main(test602.kt:10) test + +User code: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test602.Test602Kt", methodName = "main", fileName = "test602.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at Test603Kt.main(test603.kt:10) test + +User code: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test603.Test603Kt", methodName = "main", fileName = "test603.kt", lineNumber = 10) +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test604Kt.main(test604.kt:10) test + +User code: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test604.Test604Kt", methodName = "main", fileName = "test604.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test605Kt.main(test605.kt:10) test + +User code: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test605.Test605Kt", methodName = "main", fileName = "test605.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### error("error message {}", throwable) at Test609Kt.main(test609.kt:10) test + +User code: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test609.Test609Kt", methodName = "main", fileName = "test609.kt", lineNumber = 10) +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at Test610Kt.main(test610.kt:10) test + +User code: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test610.Test610Kt", methodName = "main", fileName = "test610.kt", lineNumber = 10) +} +``` + +### error(throwable) { "error messageBuilder $i" } at Test611Kt.main(test611.kt:10) test + +User code: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test611.Test611Kt", methodName = "main", fileName = "test611.kt", lineNumber = 10) +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at Test612Kt.main(test612.kt:10) test + +User code: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test612.Test612Kt", methodName = "main", fileName = "test612.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=throwable } at Test613Kt.main(test613.kt:10) test + +User code: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test613.Test613Kt", methodName = "main", fileName = "test613.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at Test614Kt.main(test614.kt:10) test + +User code: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test614.Test614Kt", methodName = "main", fileName = "test614.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test615Kt.main(test615.kt:10) test + +User code: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test615.Test615Kt", methodName = "main", fileName = "test615.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at Test616Kt.main(test616.kt:10) test + +User code: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test616.Test616Kt", methodName = "main", fileName = "test616.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at Test617Kt.main(test617.kt:10) test + +User code: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test617.Test617Kt", methodName = "main", fileName = "test617.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test618Kt.main(test618.kt:10) test + +User code: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test618.Test618Kt", methodName = "main", fileName = "test618.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at Test619Kt.main(test619.kt:10) test + +User code: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test619.Test619Kt", methodName = "main", fileName = "test619.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test620Kt.main(test620.kt:10) test + +User code: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test620.Test620Kt", methodName = "main", fileName = "test620.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test621Kt.main(test621.kt:10) test + +User code: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test621.Test621Kt", methodName = "main", fileName = "test621.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at Test622Kt.main(test622.kt:10) test + +User code: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test622.Test622Kt", methodName = "main", fileName = "test622.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at Test623Kt.main(test623.kt:10) test + +User code: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test623.Test623Kt", methodName = "main", fileName = "test623.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at Test624Kt.main(test624.kt:10) test + +User code: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test624.Test624Kt", methodName = "main", fileName = "test624.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at Test625Kt.main(test625.kt:10) test + +User code: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test625.Test625Kt", methodName = "main", fileName = "test625.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at Test629Kt.main(test629.kt:10) test + +User code: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test629.Test629Kt", methodName = "main", fileName = "test629.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at Test630Kt.main(test630.kt:10) test + +User code: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test630.Test630Kt", methodName = "main", fileName = "test630.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test631Kt.main(test631.kt:10) test + +User code: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test631.Test631Kt", methodName = "main", fileName = "test631.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at Test632Kt.main(test632.kt:10) test + +User code: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test632.Test632Kt", methodName = "main", fileName = "test632.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at Test633Kt.main(test633.kt:10) test + +User code: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test633.Test633Kt", methodName = "main", fileName = "test633.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test634Kt.main(test634.kt:10) test + +User code: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test634.Test634Kt", methodName = "main", fileName = "test634.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at Test635Kt.main(test635.kt:10) test + +User code: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) +} +``` + +Transformed into: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test635.Test635Kt", methodName = "main", fileName = "test635.kt", lineNumber = 10) +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test636Kt.main(test636.kt:10) test + +User code: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test636.Test636Kt", methodName = "main", fileName = "test636.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test637Kt.main(test637.kt:10) test + +User code: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test637.Test637Kt", methodName = "main", fileName = "test637.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### error("error message {}") at Test641Kt.main(test641.kt:10) test + +User code: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") +} +``` + +Transformed into: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test641.Test641Kt", methodName = "main", fileName = "test641.kt", lineNumber = 10) +} +``` + +
+ +### error() { "error messageBuilder" } at Test642Kt.main(test642.kt:10) test + +User code: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test642.Test642Kt", methodName = "main", fileName = "test642.kt", lineNumber = 10) +} +``` + +### error() { "error messageBuilder $i" } at Test643Kt.main(test643.kt:10) test + +User code: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test643.Test643Kt", methodName = "main", fileName = "test643.kt", lineNumber = 10) +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at Test644Kt.main(test644.kt:10) test + +User code: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test644.Test644Kt", methodName = "main", fileName = "test644.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=null } at Test645Kt.main(test645.kt:10) test + +User code: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test645.Test645Kt", methodName = "main", fileName = "test645.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at Test646Kt.main(test646.kt:10) test + +User code: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test646.Test646Kt", methodName = "main", fileName = "test646.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at Test647Kt.main(test647.kt:10) test + +User code: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test647.Test647Kt", methodName = "main", fileName = "test647.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at Test648Kt.main(test648.kt:10) test + +User code: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test648.Test648Kt", methodName = "main", fileName = "test648.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at Test649Kt.main(test649.kt:10) test + +User code: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test649.Test649Kt", methodName = "main", fileName = "test649.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at Test650Kt.main(test650.kt:10) test + +User code: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test650.Test650Kt", methodName = "main", fileName = "test650.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
+ +
featureFlag=DISABLE_COLLECTING_CALL_SITE_INFORMATION + +
with class=true + +
entry/exit API + +### entry(argument1, argument2) at MainTest.main(test1.kt:10) test + +User code: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) + } + +} +``` + +Transformed into: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entryWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "entry(argument1, argument2)")) + } + +} +``` + +### exit(resultValue) at MainTest.main(test2.kt:10) test + +User code: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) + } + +} +``` + +Transformed into: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "exit(resultValue)")) + } + +} +``` + +### exit() at MainTest.main(test3.kt:10) test + +User code: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() + } + +} +``` + +Remains as-is: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() + } + +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at MainTest.main(test4.kt:10) test + +User code: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) + } + +} +``` + +Transformed into: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "throwing(throwable)"), throwable) + } + +} +``` + +### catching(throwable) at MainTest.main(test5.kt:10) test + +User code: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) + } + +} +``` + +Transformed into: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catchingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "catching(throwable)"), throwable) + } + +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at MainTest.main(test6.kt:10) test + +User code: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test7.kt:10) test + +User code: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test8.kt:10) test + +User code: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at MainTest.main(test9.kt:10) test + +User code: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at MainTest.main(test10.kt:10) test + +User code: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test11.kt:10) test + +User code: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at MainTest.main(test12.kt:10) test + +User code: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at MainTest.main(test13.kt:10) test + +User code: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at MainTest.main(test14.kt:10) test + +User code: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test15.kt:10) test + +User code: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test16.kt:10) test + +User code: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test17.kt:10) test + +User code: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test18.kt:10) test + +User code: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test19.kt:10) test + +User code: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test20.kt:10) test + +User code: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test21.kt:10) test + +User code: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at MainTest.main(test22.kt:10) test + +User code: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test23.kt:10) test + +User code: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test24.kt:10) test + +User code: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}", throwable) at MainTest.main(test28.kt:10) test + +User code: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") + } + +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at MainTest.main(test29.kt:10) test + +User code: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"") + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at MainTest.main(test30.kt:10) test + +User code: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"") + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test31.kt:10) test + +User code: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at MainTest.main(test32.kt:10) test + +User code: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test33.kt:10) test + +User code: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test34.kt:10) test + +User code: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test35.kt:10) test + +User code: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test36.kt:10) test + +User code: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test37.kt:10) test + +User code: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at MainTest.main(test38.kt:10) test + +User code: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test39.kt:10) test + +User code: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test40.kt:10) test + +User code: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at MainTest.main(test41.kt:10) test + +User code: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at MainTest.main(test42.kt:10) test + +User code: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test43.kt:10) test + +User code: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at MainTest.main(test44.kt:10) test + +User code: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test48.kt:10) test + +User code: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test49.kt:10) test + +User code: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test50.kt:10) test + +User code: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test51.kt:10) test + +User code: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test52.kt:10) test + +User code: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test53.kt:10) test + +User code: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at MainTest.main(test54.kt:10) test + +User code: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test55.kt:10) test + +User code: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test56.kt:10) test + +User code: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}") at MainTest.main(test60.kt:10) test + +User code: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") + } + +} +``` + +Transformed into: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") + } + +} +``` + +
+ +### trace() { "trace messageBuilder" } at MainTest.main(test61.kt:10) test + +User code: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"") + } + +} +``` + +### trace() { "trace messageBuilder $i" } at MainTest.main(test62.kt:10) test + +User code: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"") + } + +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at MainTest.main(test63.kt:10) test + +User code: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at MainTest.main(test64.kt:10) test + +User code: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at MainTest.main(test65.kt:10) test + +User code: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test66.kt:10) test + +User code: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at MainTest.main(test67.kt:10) test + +User code: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test68.kt:10) test + +User code: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test69.kt:10) test + +User code: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at MainTest.main(test70.kt:10) test + +User code: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test71.kt:10) test + +User code: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test72.kt:10) test + +User code: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at MainTest.main(test73.kt:10) test + +User code: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at MainTest.main(test74.kt:10) test + +User code: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test75.kt:10) test + +User code: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at MainTest.main(test76.kt:10) test + +User code: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at MainTest.main(test77.kt:10) test + +User code: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at MainTest.main(test78.kt:10) test + +User code: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test79.kt:10) test + +User code: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test80.kt:10) test + +User code: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test81.kt:10) test + +User code: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test82.kt:10) test + +User code: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test83.kt:10) test + +User code: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test84.kt:10) test + +User code: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test85.kt:10) test + +User code: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at MainTest.main(test86.kt:10) test + +User code: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test87.kt:10) test + +User code: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test88.kt:10) test + +User code: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}", throwable) at MainTest.main(test92.kt:10) test + +User code: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") + } + +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at MainTest.main(test93.kt:10) test + +User code: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"") + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at MainTest.main(test94.kt:10) test + +User code: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"") + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test95.kt:10) test + +User code: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at MainTest.main(test96.kt:10) test + +User code: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test97.kt:10) test + +User code: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test98.kt:10) test + +User code: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test99.kt:10) test + +User code: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test100.kt:10) test + +User code: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test101.kt:10) test + +User code: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at MainTest.main(test102.kt:10) test + +User code: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test103.kt:10) test + +User code: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test104.kt:10) test + +User code: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at MainTest.main(test105.kt:10) test + +User code: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at MainTest.main(test106.kt:10) test + +User code: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test107.kt:10) test + +User code: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at MainTest.main(test108.kt:10) test + +User code: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test112.kt:10) test + +User code: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test113.kt:10) test + +User code: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test114.kt:10) test + +User code: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test115.kt:10) test + +User code: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test116.kt:10) test + +User code: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test117.kt:10) test + +User code: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at MainTest.main(test118.kt:10) test + +User code: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test119.kt:10) test + +User code: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test120.kt:10) test + +User code: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}") at MainTest.main(test124.kt:10) test + +User code: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") + } + +} +``` + +Transformed into: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") + } + +} +``` + +
+ +### debug() { "debug messageBuilder" } at MainTest.main(test125.kt:10) test + +User code: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"") + } + +} +``` + +### debug() { "debug messageBuilder $i" } at MainTest.main(test126.kt:10) test + +User code: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"") + } + +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at MainTest.main(test127.kt:10) test + +User code: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at MainTest.main(test128.kt:10) test + +User code: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at MainTest.main(test129.kt:10) test + +User code: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test130.kt:10) test + +User code: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at MainTest.main(test131.kt:10) test + +User code: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test132.kt:10) test + +User code: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test133.kt:10) test + +User code: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at MainTest.main(test134.kt:10) test + +User code: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test135.kt:10) test + +User code: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test136.kt:10) test + +User code: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at MainTest.main(test137.kt:10) test + +User code: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at MainTest.main(test138.kt:10) test + +User code: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test139.kt:10) test + +User code: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at MainTest.main(test140.kt:10) test + +User code: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at MainTest.main(test141.kt:10) test + +User code: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at MainTest.main(test142.kt:10) test + +User code: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test143.kt:10) test + +User code: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test144.kt:10) test + +User code: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test145.kt:10) test + +User code: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test146.kt:10) test + +User code: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test147.kt:10) test + +User code: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test148.kt:10) test + +User code: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test149.kt:10) test + +User code: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at MainTest.main(test150.kt:10) test + +User code: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test151.kt:10) test + +User code: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test152.kt:10) test + +User code: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}", throwable) at MainTest.main(test156.kt:10) test + +User code: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") + } + +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at MainTest.main(test157.kt:10) test + +User code: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"") + } + +} +``` + +### info(throwable) { "info messageBuilder $i" } at MainTest.main(test158.kt:10) test + +User code: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"") + } + +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test159.kt:10) test + +User code: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at MainTest.main(test160.kt:10) test + +User code: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test161.kt:10) test + +User code: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test162.kt:10) test + +User code: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at MainTest.main(test163.kt:10) test + +User code: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test164.kt:10) test + +User code: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test165.kt:10) test + +User code: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at MainTest.main(test166.kt:10) test + +User code: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test167.kt:10) test + +User code: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test168.kt:10) test + +User code: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at MainTest.main(test169.kt:10) test + +User code: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at MainTest.main(test170.kt:10) test + +User code: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test171.kt:10) test + +User code: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at MainTest.main(test172.kt:10) test + +User code: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at MainTest.main(test176.kt:10) test + +User code: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test177.kt:10) test + +User code: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test178.kt:10) test + +User code: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at MainTest.main(test179.kt:10) test + +User code: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test180.kt:10) test + +User code: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test181.kt:10) test + +User code: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at MainTest.main(test182.kt:10) test + +User code: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test183.kt:10) test + +User code: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test184.kt:10) test + +User code: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}") at MainTest.main(test188.kt:10) test + +User code: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") + } + +} +``` + +Transformed into: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") + } + +} +``` + +
+ +### info() { "info messageBuilder" } at MainTest.main(test189.kt:10) test + +User code: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"") + } + +} +``` + +### info() { "info messageBuilder $i" } at MainTest.main(test190.kt:10) test + +User code: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"") + } + +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at MainTest.main(test191.kt:10) test + +User code: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=null } at MainTest.main(test192.kt:10) test + +User code: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at MainTest.main(test193.kt:10) test + +User code: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test194.kt:10) test + +User code: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at MainTest.main(test195.kt:10) test + +User code: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at MainTest.main(test196.kt:10) test + +User code: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test197.kt:10) test + +User code: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at MainTest.main(test198.kt:10) test + +User code: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test199.kt:10) test + +User code: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test200.kt:10) test + +User code: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at MainTest.main(test201.kt:10) test + +User code: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at MainTest.main(test202.kt:10) test + +User code: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test203.kt:10) test + +User code: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at MainTest.main(test204.kt:10) test + +User code: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at MainTest.main(test205.kt:10) test + +User code: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at MainTest.main(test206.kt:10) test + +User code: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test207.kt:10) test + +User code: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test208.kt:10) test + +User code: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test209.kt:10) test + +User code: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test210.kt:10) test + +User code: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test211.kt:10) test + +User code: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test212.kt:10) test + +User code: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test213.kt:10) test + +User code: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at MainTest.main(test214.kt:10) test + +User code: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test215.kt:10) test + +User code: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test216.kt:10) test + +User code: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}", throwable) at MainTest.main(test220.kt:10) test + +User code: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") + } + +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at MainTest.main(test221.kt:10) test + +User code: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"") + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at MainTest.main(test222.kt:10) test + +User code: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"") + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test223.kt:10) test + +User code: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at MainTest.main(test224.kt:10) test + +User code: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test225.kt:10) test + +User code: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test226.kt:10) test + +User code: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test227.kt:10) test + +User code: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test228.kt:10) test + +User code: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test229.kt:10) test + +User code: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at MainTest.main(test230.kt:10) test + +User code: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test231.kt:10) test + +User code: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test232.kt:10) test + +User code: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at MainTest.main(test233.kt:10) test + +User code: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at MainTest.main(test234.kt:10) test + +User code: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test235.kt:10) test + +User code: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at MainTest.main(test236.kt:10) test + +User code: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test240.kt:10) test + +User code: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test241.kt:10) test + +User code: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test242.kt:10) test + +User code: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test243.kt:10) test + +User code: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test244.kt:10) test + +User code: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test245.kt:10) test + +User code: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at MainTest.main(test246.kt:10) test + +User code: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test247.kt:10) test + +User code: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test248.kt:10) test + +User code: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}") at MainTest.main(test252.kt:10) test + +User code: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") + } + +} +``` + +Transformed into: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") + } + +} +``` + +
+ +### warn() { "warn messageBuilder" } at MainTest.main(test253.kt:10) test + +User code: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"") + } + +} +``` + +### warn() { "warn messageBuilder $i" } at MainTest.main(test254.kt:10) test + +User code: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"") + } + +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at MainTest.main(test255.kt:10) test + +User code: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at MainTest.main(test256.kt:10) test + +User code: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at MainTest.main(test257.kt:10) test + +User code: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test258.kt:10) test + +User code: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at MainTest.main(test259.kt:10) test + +User code: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test260.kt:10) test + +User code: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test261.kt:10) test + +User code: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at MainTest.main(test262.kt:10) test + +User code: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test263.kt:10) test + +User code: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test264.kt:10) test + +User code: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at MainTest.main(test265.kt:10) test + +User code: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at MainTest.main(test266.kt:10) test + +User code: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test267.kt:10) test + +User code: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at MainTest.main(test268.kt:10) test + +User code: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at MainTest.main(test269.kt:10) test + +User code: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at MainTest.main(test270.kt:10) test + +User code: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test271.kt:10) test + +User code: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test272.kt:10) test + +User code: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test273.kt:10) test + +User code: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test274.kt:10) test + +User code: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test275.kt:10) test + +User code: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test276.kt:10) test + +User code: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test277.kt:10) test + +User code: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at MainTest.main(test278.kt:10) test + +User code: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test279.kt:10) test + +User code: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test280.kt:10) test + +User code: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}", throwable) at MainTest.main(test284.kt:10) test + +User code: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") + } + +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at MainTest.main(test285.kt:10) test + +User code: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"") + } + +} +``` + +### error(throwable) { "error messageBuilder $i" } at MainTest.main(test286.kt:10) test + +User code: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"") + } + +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test287.kt:10) test + +User code: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=throwable } at MainTest.main(test288.kt:10) test + +User code: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test289.kt:10) test + +User code: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test290.kt:10) test + +User code: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at MainTest.main(test291.kt:10) test + +User code: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test292.kt:10) test + +User code: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test293.kt:10) test + +User code: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at MainTest.main(test294.kt:10) test + +User code: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test295.kt:10) test + +User code: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test296.kt:10) test + +User code: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at MainTest.main(test297.kt:10) test + +User code: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at MainTest.main(test298.kt:10) test + +User code: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test299.kt:10) test + +User code: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at MainTest.main(test300.kt:10) test + +User code: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at MainTest.main(test304.kt:10) test + +User code: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test305.kt:10) test + +User code: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test306.kt:10) test + +User code: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at MainTest.main(test307.kt:10) test + +User code: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test308.kt:10) test + +User code: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test309.kt:10) test + +User code: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at MainTest.main(test310.kt:10) test + +User code: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test311.kt:10) test + +User code: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test312.kt:10) test + +User code: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}") at MainTest.main(test316.kt:10) test + +User code: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") + } + +} +``` + +Transformed into: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") + } + +} +``` + +
+ +### error() { "error messageBuilder" } at MainTest.main(test317.kt:10) test + +User code: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"") + } + +} +``` + +### error() { "error messageBuilder $i" } at MainTest.main(test318.kt:10) test + +User code: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"") + } + +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at MainTest.main(test319.kt:10) test + +User code: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=null } at MainTest.main(test320.kt:10) test + +User code: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at MainTest.main(test321.kt:10) test + +User code: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test322.kt:10) test + +User code: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at MainTest.main(test323.kt:10) test + +User code: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at MainTest.main(test324.kt:10) test + +User code: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test325.kt:10) test + +User code: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
+ +
with class=false + +
entry/exit API + +### entry(argument1, argument2) at Test326Kt.main(test326.kt:10) test + +User code: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) +} +``` + +Transformed into: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entryWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "entry(argument1, argument2)")) +} +``` + +### exit(resultValue) at Test327Kt.main(test327.kt:10) test + +User code: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) +} +``` + +Transformed into: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "exit(resultValue)")) +} +``` + +### exit() at Test328Kt.main(test328.kt:10) test + +User code: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() +} +``` + +Remains as-is: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at Test329Kt.main(test329.kt:10) test + +User code: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) +} +``` + +Transformed into: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "throwing(throwable)"), throwable) +} +``` + +### catching(throwable) at Test330Kt.main(test330.kt:10) test + +User code: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) +} +``` + +Transformed into: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catchingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "catching(throwable)"), throwable) +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at Test331Kt.main(test331.kt:10) test + +User code: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test332Kt.main(test332.kt:10) test + +User code: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test333Kt.main(test333.kt:10) test + +User code: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at Test334Kt.main(test334.kt:10) test + +User code: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at Test335Kt.main(test335.kt:10) test + +User code: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at Test336Kt.main(test336.kt:10) test + +User code: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at Test337Kt.main(test337.kt:10) test + +User code: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at Test338Kt.main(test338.kt:10) test + +User code: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at Test339Kt.main(test339.kt:10) test + +User code: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at Test340Kt.main(test340.kt:10) test + +User code: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at Test341Kt.main(test341.kt:10) test + +User code: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at Test342Kt.main(test342.kt:10) test + +User code: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test343Kt.main(test343.kt:10) test + +User code: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at Test344Kt.main(test344.kt:10) test + +User code: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at Test345Kt.main(test345.kt:10) test + +User code: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test346Kt.main(test346.kt:10) test + +User code: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at Test347Kt.main(test347.kt:10) test + +User code: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test348Kt.main(test348.kt:10) test + +User code: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test349Kt.main(test349.kt:10) test + +User code: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}", throwable) at Test353Kt.main(test353.kt:10) test + +User code: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at Test354Kt.main(test354.kt:10) test + +User code: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"") +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at Test355Kt.main(test355.kt:10) test + +User code: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"") +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at Test356Kt.main(test356.kt:10) test + +User code: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at Test357Kt.main(test357.kt:10) test + +User code: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at Test358Kt.main(test358.kt:10) test + +User code: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test359Kt.main(test359.kt:10) test + +User code: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at Test360Kt.main(test360.kt:10) test + +User code: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at Test361Kt.main(test361.kt:10) test + +User code: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test362Kt.main(test362.kt:10) test + +User code: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at Test363Kt.main(test363.kt:10) test + +User code: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test364Kt.main(test364.kt:10) test + +User code: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test365Kt.main(test365.kt:10) test + +User code: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at Test366Kt.main(test366.kt:10) test + +User code: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at Test367Kt.main(test367.kt:10) test + +User code: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at Test368Kt.main(test368.kt:10) test + +User code: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at Test369Kt.main(test369.kt:10) test + +User code: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at Test373Kt.main(test373.kt:10) test + +User code: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at Test374Kt.main(test374.kt:10) test + +User code: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test375Kt.main(test375.kt:10) test + +User code: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at Test376Kt.main(test376.kt:10) test + +User code: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at Test377Kt.main(test377.kt:10) test + +User code: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test378Kt.main(test378.kt:10) test + +User code: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at Test379Kt.main(test379.kt:10) test + +User code: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) +} +``` + +Transformed into: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test380Kt.main(test380.kt:10) test + +User code: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test381Kt.main(test381.kt:10) test + +User code: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}") at Test385Kt.main(test385.kt:10) test + +User code: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") +} +``` + +Transformed into: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") +} +``` + +
+ +### trace() { "trace messageBuilder" } at Test386Kt.main(test386.kt:10) test + +User code: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"") +} +``` + +### trace() { "trace messageBuilder $i" } at Test387Kt.main(test387.kt:10) test + +User code: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"") +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at Test388Kt.main(test388.kt:10) test + +User code: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at Test389Kt.main(test389.kt:10) test + +User code: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at Test390Kt.main(test390.kt:10) test + +User code: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at Test391Kt.main(test391.kt:10) test + +User code: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at Test392Kt.main(test392.kt:10) test + +User code: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at Test393Kt.main(test393.kt:10) test + +User code: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test394Kt.main(test394.kt:10) test + +User code: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at Test395Kt.main(test395.kt:10) test + +User code: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test396Kt.main(test396.kt:10) test + +User code: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test397Kt.main(test397.kt:10) test + +User code: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at Test398Kt.main(test398.kt:10) test + +User code: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at Test399Kt.main(test399.kt:10) test + +User code: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at Test400Kt.main(test400.kt:10) test + +User code: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at Test401Kt.main(test401.kt:10) test + +User code: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at Test402Kt.main(test402.kt:10) test + +User code: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at Test403Kt.main(test403.kt:10) test + +User code: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at Test404Kt.main(test404.kt:10) test + +User code: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at Test405Kt.main(test405.kt:10) test + +User code: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at Test406Kt.main(test406.kt:10) test + +User code: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test407Kt.main(test407.kt:10) test + +User code: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at Test408Kt.main(test408.kt:10) test + +User code: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at Test409Kt.main(test409.kt:10) test + +User code: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test410Kt.main(test410.kt:10) test + +User code: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at Test411Kt.main(test411.kt:10) test + +User code: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test412Kt.main(test412.kt:10) test + +User code: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test413Kt.main(test413.kt:10) test + +User code: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}", throwable) at Test417Kt.main(test417.kt:10) test + +User code: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at Test418Kt.main(test418.kt:10) test + +User code: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"") +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at Test419Kt.main(test419.kt:10) test + +User code: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"") +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at Test420Kt.main(test420.kt:10) test + +User code: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at Test421Kt.main(test421.kt:10) test + +User code: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at Test422Kt.main(test422.kt:10) test + +User code: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test423Kt.main(test423.kt:10) test + +User code: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at Test424Kt.main(test424.kt:10) test + +User code: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at Test425Kt.main(test425.kt:10) test + +User code: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test426Kt.main(test426.kt:10) test + +User code: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at Test427Kt.main(test427.kt:10) test + +User code: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test428Kt.main(test428.kt:10) test + +User code: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test429Kt.main(test429.kt:10) test + +User code: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at Test430Kt.main(test430.kt:10) test + +User code: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at Test431Kt.main(test431.kt:10) test + +User code: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at Test432Kt.main(test432.kt:10) test + +User code: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at Test433Kt.main(test433.kt:10) test + +User code: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at Test437Kt.main(test437.kt:10) test + +User code: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at Test438Kt.main(test438.kt:10) test + +User code: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test439Kt.main(test439.kt:10) test + +User code: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at Test440Kt.main(test440.kt:10) test + +User code: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at Test441Kt.main(test441.kt:10) test + +User code: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test442Kt.main(test442.kt:10) test + +User code: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at Test443Kt.main(test443.kt:10) test + +User code: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) +} +``` + +Transformed into: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test444Kt.main(test444.kt:10) test + +User code: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test445Kt.main(test445.kt:10) test + +User code: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}") at Test449Kt.main(test449.kt:10) test + +User code: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") +} +``` + +Transformed into: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") +} +``` + +
+ +### debug() { "debug messageBuilder" } at Test450Kt.main(test450.kt:10) test + +User code: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"") +} +``` + +### debug() { "debug messageBuilder $i" } at Test451Kt.main(test451.kt:10) test + +User code: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"") +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at Test452Kt.main(test452.kt:10) test + +User code: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at Test453Kt.main(test453.kt:10) test + +User code: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at Test454Kt.main(test454.kt:10) test + +User code: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at Test455Kt.main(test455.kt:10) test + +User code: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at Test456Kt.main(test456.kt:10) test + +User code: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at Test457Kt.main(test457.kt:10) test + +User code: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test458Kt.main(test458.kt:10) test + +User code: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at Test459Kt.main(test459.kt:10) test + +User code: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test460Kt.main(test460.kt:10) test + +User code: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test461Kt.main(test461.kt:10) test + +User code: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at Test462Kt.main(test462.kt:10) test + +User code: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at Test463Kt.main(test463.kt:10) test + +User code: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at Test464Kt.main(test464.kt:10) test + +User code: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at Test465Kt.main(test465.kt:10) test + +User code: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at Test466Kt.main(test466.kt:10) test + +User code: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at Test467Kt.main(test467.kt:10) test + +User code: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at Test468Kt.main(test468.kt:10) test + +User code: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at Test469Kt.main(test469.kt:10) test + +User code: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at Test470Kt.main(test470.kt:10) test + +User code: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test471Kt.main(test471.kt:10) test + +User code: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at Test472Kt.main(test472.kt:10) test + +User code: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at Test473Kt.main(test473.kt:10) test + +User code: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test474Kt.main(test474.kt:10) test + +User code: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at Test475Kt.main(test475.kt:10) test + +User code: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test476Kt.main(test476.kt:10) test + +User code: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test477Kt.main(test477.kt:10) test + +User code: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 +``` + +
+ +### info("info message {}", throwable) at Test481Kt.main(test481.kt:10) test + +User code: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at Test482Kt.main(test482.kt:10) test + +User code: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"") +} +``` + +### info(throwable) { "info messageBuilder $i" } at Test483Kt.main(test483.kt:10) test + +User code: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"") +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at Test484Kt.main(test484.kt:10) test + +User code: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at Test485Kt.main(test485.kt:10) test + +User code: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at Test486Kt.main(test486.kt:10) test + +User code: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test487Kt.main(test487.kt:10) test + +User code: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at Test488Kt.main(test488.kt:10) test + +User code: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at Test489Kt.main(test489.kt:10) test + +User code: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test490Kt.main(test490.kt:10) test + +User code: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at Test491Kt.main(test491.kt:10) test + +User code: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test492Kt.main(test492.kt:10) test + +User code: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test493Kt.main(test493.kt:10) test + +User code: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at Test494Kt.main(test494.kt:10) test + +User code: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at Test495Kt.main(test495.kt:10) test + +User code: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at Test496Kt.main(test496.kt:10) test + +User code: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at Test497Kt.main(test497.kt:10) test + +User code: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at Test501Kt.main(test501.kt:10) test + +User code: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at Test502Kt.main(test502.kt:10) test + +User code: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test503Kt.main(test503.kt:10) test + +User code: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at Test504Kt.main(test504.kt:10) test + +User code: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at Test505Kt.main(test505.kt:10) test + +User code: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test506Kt.main(test506.kt:10) test + +User code: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at Test507Kt.main(test507.kt:10) test + +User code: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) +} +``` + +Transformed into: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test508Kt.main(test508.kt:10) test + +User code: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test509Kt.main(test509.kt:10) test + +User code: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 +``` + +
+ +### info("info message {}") at Test513Kt.main(test513.kt:10) test + +User code: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") +} +``` + +Transformed into: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") +} +``` + +
+ +### info() { "info messageBuilder" } at Test514Kt.main(test514.kt:10) test + +User code: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"") +} +``` + +### info() { "info messageBuilder $i" } at Test515Kt.main(test515.kt:10) test + +User code: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"") +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at Test516Kt.main(test516.kt:10) test + +User code: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=null } at Test517Kt.main(test517.kt:10) test + +User code: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at Test518Kt.main(test518.kt:10) test + +User code: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at Test519Kt.main(test519.kt:10) test + +User code: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at Test520Kt.main(test520.kt:10) test + +User code: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at Test521Kt.main(test521.kt:10) test + +User code: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at Test522Kt.main(test522.kt:10) test + +User code: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at Test523Kt.main(test523.kt:10) test + +User code: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test524Kt.main(test524.kt:10) test + +User code: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test525Kt.main(test525.kt:10) test + +User code: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at Test526Kt.main(test526.kt:10) test + +User code: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at Test527Kt.main(test527.kt:10) test + +User code: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at Test528Kt.main(test528.kt:10) test + +User code: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at Test529Kt.main(test529.kt:10) test + +User code: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at Test530Kt.main(test530.kt:10) test + +User code: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at Test531Kt.main(test531.kt:10) test + +User code: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at Test532Kt.main(test532.kt:10) test + +User code: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at Test533Kt.main(test533.kt:10) test + +User code: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at Test534Kt.main(test534.kt:10) test + +User code: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test535Kt.main(test535.kt:10) test + +User code: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at Test536Kt.main(test536.kt:10) test + +User code: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at Test537Kt.main(test537.kt:10) test + +User code: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test538Kt.main(test538.kt:10) test + +User code: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at Test539Kt.main(test539.kt:10) test + +User code: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test540Kt.main(test540.kt:10) test + +User code: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test541Kt.main(test541.kt:10) test + +User code: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}", throwable) at Test545Kt.main(test545.kt:10) test + +User code: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at Test546Kt.main(test546.kt:10) test + +User code: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"") +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at Test547Kt.main(test547.kt:10) test + +User code: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"") +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at Test548Kt.main(test548.kt:10) test + +User code: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at Test549Kt.main(test549.kt:10) test + +User code: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at Test550Kt.main(test550.kt:10) test + +User code: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test551Kt.main(test551.kt:10) test + +User code: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at Test552Kt.main(test552.kt:10) test + +User code: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at Test553Kt.main(test553.kt:10) test + +User code: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test554Kt.main(test554.kt:10) test + +User code: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at Test555Kt.main(test555.kt:10) test + +User code: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test556Kt.main(test556.kt:10) test + +User code: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test557Kt.main(test557.kt:10) test + +User code: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at Test558Kt.main(test558.kt:10) test + +User code: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at Test559Kt.main(test559.kt:10) test + +User code: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at Test560Kt.main(test560.kt:10) test + +User code: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at Test561Kt.main(test561.kt:10) test + +User code: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at Test565Kt.main(test565.kt:10) test + +User code: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at Test566Kt.main(test566.kt:10) test + +User code: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test567Kt.main(test567.kt:10) test + +User code: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at Test568Kt.main(test568.kt:10) test + +User code: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at Test569Kt.main(test569.kt:10) test + +User code: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test570Kt.main(test570.kt:10) test + +User code: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at Test571Kt.main(test571.kt:10) test + +User code: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) +} +``` + +Transformed into: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test572Kt.main(test572.kt:10) test + +User code: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test573Kt.main(test573.kt:10) test + +User code: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}") at Test577Kt.main(test577.kt:10) test + +User code: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") +} +``` + +Transformed into: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") +} +``` + +
+ +### warn() { "warn messageBuilder" } at Test578Kt.main(test578.kt:10) test + +User code: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"") +} +``` + +### warn() { "warn messageBuilder $i" } at Test579Kt.main(test579.kt:10) test + +User code: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"") +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at Test580Kt.main(test580.kt:10) test + +User code: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at Test581Kt.main(test581.kt:10) test + +User code: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at Test582Kt.main(test582.kt:10) test + +User code: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at Test583Kt.main(test583.kt:10) test + +User code: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at Test584Kt.main(test584.kt:10) test + +User code: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at Test585Kt.main(test585.kt:10) test + +User code: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test586Kt.main(test586.kt:10) test + +User code: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at Test587Kt.main(test587.kt:10) test + +User code: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test588Kt.main(test588.kt:10) test + +User code: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test589Kt.main(test589.kt:10) test + +User code: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at Test590Kt.main(test590.kt:10) test + +User code: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at Test591Kt.main(test591.kt:10) test + +User code: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at Test592Kt.main(test592.kt:10) test + +User code: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at Test593Kt.main(test593.kt:10) test + +User code: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at Test594Kt.main(test594.kt:10) test + +User code: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at Test595Kt.main(test595.kt:10) test + +User code: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at Test596Kt.main(test596.kt:10) test + +User code: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at Test597Kt.main(test597.kt:10) test + +User code: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at Test598Kt.main(test598.kt:10) test + +User code: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test599Kt.main(test599.kt:10) test + +User code: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at Test600Kt.main(test600.kt:10) test + +User code: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at Test601Kt.main(test601.kt:10) test + +User code: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test602Kt.main(test602.kt:10) test + +User code: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at Test603Kt.main(test603.kt:10) test + +User code: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test604Kt.main(test604.kt:10) test + +User code: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test605Kt.main(test605.kt:10) test + +User code: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 +``` + +
+ +### error("error message {}", throwable) at Test609Kt.main(test609.kt:10) test + +User code: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at Test610Kt.main(test610.kt:10) test + +User code: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"") +} +``` + +### error(throwable) { "error messageBuilder $i" } at Test611Kt.main(test611.kt:10) test + +User code: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"") +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at Test612Kt.main(test612.kt:10) test + +User code: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=throwable } at Test613Kt.main(test613.kt:10) test + +User code: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at Test614Kt.main(test614.kt:10) test + +User code: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test615Kt.main(test615.kt:10) test + +User code: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at Test616Kt.main(test616.kt:10) test + +User code: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at Test617Kt.main(test617.kt:10) test + +User code: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test618Kt.main(test618.kt:10) test + +User code: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at Test619Kt.main(test619.kt:10) test + +User code: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test620Kt.main(test620.kt:10) test + +User code: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test621Kt.main(test621.kt:10) test + +User code: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at Test622Kt.main(test622.kt:10) test + +User code: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at Test623Kt.main(test623.kt:10) test + +User code: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at Test624Kt.main(test624.kt:10) test + +User code: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at Test625Kt.main(test625.kt:10) test + +User code: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at Test629Kt.main(test629.kt:10) test + +User code: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at Test630Kt.main(test630.kt:10) test + +User code: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test631Kt.main(test631.kt:10) test + +User code: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at Test632Kt.main(test632.kt:10) test + +User code: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at Test633Kt.main(test633.kt:10) test + +User code: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test634Kt.main(test634.kt:10) test + +User code: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at Test635Kt.main(test635.kt:10) test + +User code: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) +} +``` + +Transformed into: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test636Kt.main(test636.kt:10) test + +User code: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test637Kt.main(test637.kt:10) test + +User code: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 +``` + +
+ +### error("error message {}") at Test641Kt.main(test641.kt:10) test + +User code: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") +} +``` + +Transformed into: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") +} +``` + +
+ +### error() { "error messageBuilder" } at Test642Kt.main(test642.kt:10) test + +User code: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"") +} +``` + +### error() { "error messageBuilder $i" } at Test643Kt.main(test643.kt:10) test + +User code: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"") +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at Test644Kt.main(test644.kt:10) test + +User code: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=null } at Test645Kt.main(test645.kt:10) test + +User code: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at Test646Kt.main(test646.kt:10) test + +User code: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at Test647Kt.main(test647.kt:10) test + +User code: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at Test648Kt.main(test648.kt:10) test + +User code: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at Test649Kt.main(test649.kt:10) test + +User code: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at Test650Kt.main(test650.kt:10) test + +User code: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
+ +
\ No newline at end of file diff --git a/kotlin-ir-plugin/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingCommandLineProcessor.kt b/kotlin-ir-plugin/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingCommandLineProcessor.kt new file mode 100644 index 00000000..6a5d0bbc --- /dev/null +++ b/kotlin-ir-plugin/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingCommandLineProcessor.kt @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2020 Brian Norman + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@file:OptIn(ExperimentalCompilerApi::class) + +package io.github.oshai.kotlinlogging.irplugin + +import com.google.auto.service.AutoService +import org.jetbrains.kotlin.compiler.plugin.AbstractCliOption +import org.jetbrains.kotlin.compiler.plugin.CliOption +import org.jetbrains.kotlin.compiler.plugin.CommandLineProcessor +import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi +import org.jetbrains.kotlin.config.CompilerConfiguration +import org.jetbrains.kotlin.config.CompilerConfigurationKey + +// Based on https://github.com/bnorm/kotlin-ir-plugin-template +@AutoService(CommandLineProcessor::class) +class KotlinLoggingCommandLineProcessor : CommandLineProcessor { + companion object { + private const val OPTION_DISABLE_ALL = "disableAll" + private const val OPTION_DISABLE_TRANSFORMING_DEPRECATED_API = + "disableTransformingDeprecatedApi" + private const val OPTION_DISABLE_TRANSFORMING_NOT_IMPLEMENTED_API = + "disableTransformingNotImplementedApi" + private const val OPTION_DISABLE_TRANSFORMING_ENTRY_EXIT_API = "disableTransformingEntryExitApi" + private const val OPTION_DISABLE_TRANSFORMING_THROWING_CATCHING_API = + "disableTransformingThrowingCatchingApi" + private const val OPTION_DISABLE_COLLECTING_CALL_SITE_INFORMATION = + "disableCollectingCallSiteInformation" + + val ARG_DISABLE_ALL = CompilerConfigurationKey(OPTION_DISABLE_ALL) + val ARG_DISABLE_TRANSFORMING_DEPRECATED_API = + CompilerConfigurationKey(OPTION_DISABLE_TRANSFORMING_DEPRECATED_API) + val ARG_DISABLE_TRANSFORMING_NOT_IMPLEMENTED_API = + CompilerConfigurationKey(OPTION_DISABLE_TRANSFORMING_NOT_IMPLEMENTED_API) + val ARG_DISABLE_TRANSFORMING_ENTRY_EXIT_API = + CompilerConfigurationKey(OPTION_DISABLE_TRANSFORMING_ENTRY_EXIT_API) + val ARG_DISABLE_TRANSFORMING_THROWING_CATCHING_API = + CompilerConfigurationKey(OPTION_DISABLE_TRANSFORMING_THROWING_CATCHING_API) + val ARG_DISABLE_COLLECTING_CALL_SITE_INFORMATION = + CompilerConfigurationKey(OPTION_DISABLE_COLLECTING_CALL_SITE_INFORMATION) + } + + override val pluginId: String = BuildConfig.KOTLIN_PLUGIN_ID + + override val pluginOptions: Collection = + listOf( + CliOption( + optionName = OPTION_DISABLE_ALL, + valueDescription = "boolean", + description = "Disable all transformations", + required = false, + ), + CliOption( + optionName = OPTION_DISABLE_TRANSFORMING_DEPRECATED_API, + valueDescription = "boolean", + description = "Disable transforming KLogger deprecated API to non-deprecated API", + required = false, + ), + CliOption( + optionName = OPTION_DISABLE_TRANSFORMING_NOT_IMPLEMENTED_API, + valueDescription = "boolean", + description = + "Disable transforming KLogger deprecated (and not implemented) API to non-deprecated API", + required = false, + ), + CliOption( + optionName = OPTION_DISABLE_TRANSFORMING_ENTRY_EXIT_API, + valueDescription = "boolean", + description = "Disable transforming KLogger entry/exit API", + required = false, + ), + CliOption( + optionName = OPTION_DISABLE_TRANSFORMING_THROWING_CATCHING_API, + valueDescription = "boolean", + description = "Disable transforming KLogger throwing/catching API", + required = false, + ), + CliOption( + optionName = OPTION_DISABLE_COLLECTING_CALL_SITE_INFORMATION, + valueDescription = "boolean", + description = "Disable collecting call site information", + required = false, + ), + ) + + override fun processOption( + option: AbstractCliOption, + value: String, + configuration: CompilerConfiguration, + ) { + return when (option.optionName) { + OPTION_DISABLE_ALL -> configuration.put(ARG_DISABLE_ALL, value.toBoolean()) + OPTION_DISABLE_TRANSFORMING_DEPRECATED_API -> + configuration.put(ARG_DISABLE_TRANSFORMING_DEPRECATED_API, value.toBoolean()) + OPTION_DISABLE_TRANSFORMING_NOT_IMPLEMENTED_API -> + configuration.put(ARG_DISABLE_TRANSFORMING_NOT_IMPLEMENTED_API, value.toBoolean()) + OPTION_DISABLE_TRANSFORMING_ENTRY_EXIT_API -> + configuration.put(ARG_DISABLE_TRANSFORMING_ENTRY_EXIT_API, value.toBoolean()) + OPTION_DISABLE_TRANSFORMING_THROWING_CATCHING_API -> + configuration.put(ARG_DISABLE_TRANSFORMING_THROWING_CATCHING_API, value.toBoolean()) + OPTION_DISABLE_COLLECTING_CALL_SITE_INFORMATION -> + configuration.put(ARG_DISABLE_COLLECTING_CALL_SITE_INFORMATION, value.toBoolean()) + else -> throw IllegalArgumentException("Unexpected config option: ${option.optionName}") + } + } +} diff --git a/kotlin-ir-plugin/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingCompilerRegistrar.kt b/kotlin-ir-plugin/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingCompilerRegistrar.kt new file mode 100644 index 00000000..d6d42603 --- /dev/null +++ b/kotlin-ir-plugin/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingCompilerRegistrar.kt @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2020 Brian Norman + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@file:OptIn(ExperimentalCompilerApi::class) + +package io.github.oshai.kotlinlogging.irplugin + +import com.google.auto.service.AutoService +import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension +import org.jetbrains.kotlin.cli.common.messages.MessageCollector +import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar +import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi +import org.jetbrains.kotlin.config.CommonConfigurationKeys +import org.jetbrains.kotlin.config.CompilerConfiguration + +// Based on https://github.com/bnorm/kotlin-ir-plugin-template +@AutoService(CompilerPluginRegistrar::class) +class KotlinLoggingCompilerRegistrar(private val defaultConfig: KotlinLoggingIrPluginConfig) : + CompilerPluginRegistrar() { + override val supportsK2 = true + + @Suppress("unused") // Used by service loader + constructor() : this(KotlinLoggingIrPluginConfig()) + + override fun ExtensionStorage.registerExtensions(configuration: CompilerConfiguration) { + val messageCollector = + configuration[CommonConfigurationKeys.MESSAGE_COLLECTOR_KEY] ?: MessageCollector.NONE + val config = + KotlinLoggingIrPluginConfig( + disableAll = + configuration[KotlinLoggingCommandLineProcessor.ARG_DISABLE_ALL] + ?: defaultConfig.disableAll, + disableTransformingDeprecatedApi = + configuration[KotlinLoggingCommandLineProcessor.ARG_DISABLE_TRANSFORMING_DEPRECATED_API] + ?: defaultConfig.disableTransformingDeprecatedApi, + disableTransformingNotImplementedApi = + configuration[ + KotlinLoggingCommandLineProcessor.ARG_DISABLE_TRANSFORMING_NOT_IMPLEMENTED_API] + ?: defaultConfig.disableTransformingNotImplementedApi, + disableTransformingEntryExitApi = + configuration[KotlinLoggingCommandLineProcessor.ARG_DISABLE_TRANSFORMING_ENTRY_EXIT_API] + ?: defaultConfig.disableTransformingEntryExitApi, + disableTransformingThrowingCatchingApi = + configuration[ + KotlinLoggingCommandLineProcessor.ARG_DISABLE_TRANSFORMING_THROWING_CATCHING_API] + ?: defaultConfig.disableTransformingThrowingCatchingApi, + disableCollectingCallSiteInformation = + configuration[ + KotlinLoggingCommandLineProcessor.ARG_DISABLE_COLLECTING_CALL_SITE_INFORMATION] + ?: defaultConfig.disableCollectingCallSiteInformation, + ) + IrGenerationExtension.registerExtension( + KotlinLoggingIrGenerationExtension(messageCollector, config) + ) + } +} diff --git a/kotlin-ir-plugin/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingIrGenerationExtension.kt b/kotlin-ir-plugin/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingIrGenerationExtension.kt new file mode 100644 index 00000000..f811cf09 --- /dev/null +++ b/kotlin-ir-plugin/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingIrGenerationExtension.kt @@ -0,0 +1,898 @@ +package io.github.oshai.kotlinlogging.irplugin + +import com.javiersc.kotlin.compiler.extensions.ir.createIrBlockBody +import com.javiersc.kotlin.compiler.extensions.ir.createIrFunctionExpression +import com.javiersc.kotlin.compiler.extensions.ir.createLambdaIrSimpleFunction +import com.javiersc.kotlin.compiler.extensions.ir.toIrConstructorCall +import com.javiersc.kotlin.compiler.extensions.ir.toIrGetEnumValue +import org.jetbrains.kotlin.backend.common.FileLoweringPass +import org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext +import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension +import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext +import org.jetbrains.kotlin.backend.common.lower.DeclarationIrBuilder +import org.jetbrains.kotlin.backend.common.pop +import org.jetbrains.kotlin.backend.common.push +import org.jetbrains.kotlin.backend.jvm.codegen.isAnnotatedWithDeprecated +import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity +import org.jetbrains.kotlin.cli.common.messages.MessageCollector +import org.jetbrains.kotlin.ir.IrElement +import org.jetbrains.kotlin.ir.IrStatement +import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET +import org.jetbrains.kotlin.ir.backend.js.utils.valueArguments +import org.jetbrains.kotlin.ir.builders.declarations.UNDEFINED_PARAMETER_INDEX +import org.jetbrains.kotlin.ir.builders.irCall +import org.jetbrains.kotlin.ir.builders.irInt +import org.jetbrains.kotlin.ir.builders.irString +import org.jetbrains.kotlin.ir.declarations.IrClass +import org.jetbrains.kotlin.ir.declarations.IrDeclarationBase +import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin +import org.jetbrains.kotlin.ir.declarations.IrDeclarationParent +import org.jetbrains.kotlin.ir.declarations.IrEnumEntry +import org.jetbrains.kotlin.ir.declarations.IrFile +import org.jetbrains.kotlin.ir.declarations.IrFunction +import org.jetbrains.kotlin.ir.declarations.IrModuleFragment +import org.jetbrains.kotlin.ir.declarations.IrValueParameter +import org.jetbrains.kotlin.ir.expressions.IrCall +import org.jetbrains.kotlin.ir.expressions.IrConst +import org.jetbrains.kotlin.ir.expressions.IrConstructorCall +import org.jetbrains.kotlin.ir.expressions.IrExpression +import org.jetbrains.kotlin.ir.expressions.IrFunctionExpression +import org.jetbrains.kotlin.ir.expressions.IrGetEnumValue +import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin +import org.jetbrains.kotlin.ir.expressions.IrVararg +import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl +import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol +import org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI +import org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl +import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.types.classOrFail +import org.jetbrains.kotlin.ir.types.classifierOrFail +import org.jetbrains.kotlin.ir.types.createType +import org.jetbrains.kotlin.ir.types.defaultType +import org.jetbrains.kotlin.ir.types.typeWith +import org.jetbrains.kotlin.ir.util.dump +import org.jetbrains.kotlin.ir.util.dumpKotlinLike +import org.jetbrains.kotlin.ir.util.functions +import org.jetbrains.kotlin.ir.util.getPropertySetter +import org.jetbrains.kotlin.ir.util.isEnumClass +import org.jetbrains.kotlin.ir.util.kotlinFqName +import org.jetbrains.kotlin.ir.util.primaryConstructor +import org.jetbrains.kotlin.ir.util.statements +import org.jetbrains.kotlin.ir.visitors.* +import org.jetbrains.kotlin.name.CallableId +import org.jetbrains.kotlin.name.ClassId +import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.util.capitalizeDecapitalize.toUpperCaseAsciiOnly + +private const val PACKAGE_NAME = "io.github.oshai.kotlinlogging" +private const val PACKAGE_NAME_INTERNAL = "io.github.oshai.kotlinlogging.internal" + +class KotlinLoggingIrGenerationExtension( + private val messageCollector: MessageCollector, + private val config: KotlinLoggingIrPluginConfig, +) : IrGenerationExtension { + override fun generate(moduleFragment: IrModuleFragment, pluginContext: IrPluginContext) { + messageCollector.report(CompilerMessageSeverity.INFO, "Plugin config: $config") + for (file in moduleFragment.files) { + AccessorCallTransformer(config, SourceFile(file), pluginContext, messageCollector) + .runOnFileInOrder(file) + } + } + + class TypesHelper(context: IrPluginContext) { + + val atMethodName = Name.identifier("at") + val extensionReceiverParameterName = Name.identifier("\$this\$at") + + val levelClassSymbol = + context.referenceClass(ClassId(FqName(PACKAGE_NAME), Name.identifier("Level")))!! + val markerClassSymbol = + context.referenceClass(ClassId(FqName(PACKAGE_NAME), Name.identifier("Marker")))!! + val markerType = markerClassSymbol.defaultType + val throwableType = context.irBuiltIns.throwableType + + val function1Class = context.irBuiltIns.functionN(1) + val unitType = context.irBuiltIns.unitType + val eventBuilderClassSymbol = + context.referenceClass( + ClassId(FqName(PACKAGE_NAME), Name.identifier("KLoggingEventBuilder")) + )!! + val eventBuilderLambdaType = + function1Class.typeWith(eventBuilderClassSymbol.defaultType, unitType) + @OptIn(UnsafeDuringIrConstructionAPI::class) + val setMessageFunction = eventBuilderClassSymbol.owner.getPropertySetter("message")!! + @OptIn(UnsafeDuringIrConstructionAPI::class) + val setCauseFunction = eventBuilderClassSymbol.owner.getPropertySetter("cause")!! + @OptIn(UnsafeDuringIrConstructionAPI::class) + val setInternalCompilerDataFunction = + eventBuilderClassSymbol.owner.getPropertySetter("internalCompilerData")!! + val internalCompilerDataClassSymbol = + context.referenceClass( + ClassId( + FqName(PACKAGE_NAME), + FqName("KLoggingEventBuilder.InternalCompilerData"), + isLocal = false, + ) + )!! + @OptIn(UnsafeDuringIrConstructionAPI::class) + val internalCompilerDataConstructor = internalCompilerDataClassSymbol.owner.primaryConstructor!! + + val function0Class = context.irBuiltIns.functionN(0) + val anyType = context.irBuiltIns.anyType + val messageBuilderLambdaType = function0Class.typeWith(anyType) + val stringType = context.irBuiltIns.stringType + + @OptIn(UnsafeDuringIrConstructionAPI::class) + val toStringFunctionSymbol = + context + .referenceFunctions( + CallableId(packageName = FqName(PACKAGE_NAME_INTERNAL), Name.identifier("toStringSafe")) + ) + .single { + it.owner.extensionReceiverParameter?.type?.classifierOrFail == + messageBuilderLambdaType.classifierOrFail + } + @OptIn(UnsafeDuringIrConstructionAPI::class) + val castToThrowableFunctionSymbol = + context + .referenceFunctions( + CallableId( + packageName = FqName(PACKAGE_NAME_INTERNAL), + Name.identifier("castToThrowable"), + ) + ) + .single { + it.owner.extensionReceiverParameter?.type?.classifierOrFail == anyType.classifierOrFail + } + + val kLoggerClassSymbol = + context.referenceClass(ClassId(FqName(PACKAGE_NAME), Name.identifier("KLogger")))!! + } + + class AccessorCallTransformer( + private val config: KotlinLoggingIrPluginConfig, + private val sourceFile: SourceFile, + private val context: IrPluginContext, + private val messageCollector: MessageCollector, + ) : IrElementTransformerVoidWithContext(), FileLoweringPass { + + private val typesHelper = TypesHelper(context) + + @OptIn(UnsafeDuringIrConstructionAPI::class) + fun findKLoggerExtensionFunction( + originalFunctionName: String, + extraFilter: (IrFunction) -> Boolean = { _ -> true }, + ): IrSimpleFunctionSymbol { + val overloadedFunctionName = "${originalFunctionName}WithCompilerData" + return context + .referenceFunctions( + CallableId( + packageName = FqName(PACKAGE_NAME_INTERNAL), + Name.identifier(overloadedFunctionName), + ) + ) + .single { + it.owner.extensionReceiverParameter?.type?.classifierOrFail == + typesHelper.kLoggerClassSymbol.defaultType.classifierOrFail && + extraFilter.invoke(it.owner) + } + } + + override fun lower(irFile: IrFile) { + irFile.transformChildrenVoid() + } + + private var parentDeclarations = ArrayDeque() + private var parentDeclaration: IrDeclarationParent? = null + private var parentClass: IrClass? = null + + override fun visitDeclaration(declaration: IrDeclarationBase): IrStatement { + if (config.disableAll) return super.visitDeclaration(declaration) + parentDeclarations.push(declaration) + if (declaration is IrDeclarationParent) parentDeclaration = declaration + if (declaration is IrClass) parentClass = declaration + try { + return super.visitDeclaration(declaration) + } finally { + parentDeclarations.pop() + val lastDeclaration = parentDeclarations.lastOrNull() + if (lastDeclaration is IrDeclarationParent) parentDeclaration = lastDeclaration + if (lastDeclaration is IrClass) parentClass = lastDeclaration + } + } + + @OptIn(UnsafeDuringIrConstructionAPI::class) + override fun visitCall(expression: IrCall): IrExpression { + if (config.disableAll) return super.visitCall(expression) + try { + expression.symbol.owner.parent.let { + if (it.kotlinFqName == FqName("io.github.oshai.kotlinlogging.KLogger")) { + return handleKLoggerFunction(expression) + } + } + return super.visitCall(expression) + } catch (e: Exception) { + messageCollector.report( + CompilerMessageSeverity.INFO, + "Error while processing call: ${e.message}", + ) + messageCollector.report( + severity = CompilerMessageSeverity.WARNING, + message = + """Kotlin-logging IR plugin failed. + Please report to https://github.com/oshai/kotlin-logging/issues and include the below information. + Error: ${e.message} + ${e.stackTraceToString()} + Expression source code: ${sourceFile.getText(expression)} + Expression raw dump: ${expression.dump()} + Expression Kotlin-like dump: ${expression.dumpKotlinLike()} + """ + .trimIndent(), + ) + return expression + } + } + + @OptIn(UnsafeDuringIrConstructionAPI::class) + private fun handleKLoggerFunction(expression: IrCall): IrExpression { + val newExpr = + when (expression.symbol.owner.name.asString()) { + "trace", + "debug", + "info", + "warn", + "error" -> { + if ( + config.disableTransformingNotImplementedApi && + expression.isNotImplementedKLoggerApiCall(typesHelper) + ) { + return super.visitCall(expression) + } + if ( + config.disableTransformingDeprecatedApi && + expression.symbol.owner.isAnnotatedWithDeprecated + ) { + return super.visitCall(expression) + } + val (newStatement, messageTemplate) = createAtStatement(expression) + injectCompilerOptionsIntoAtStatement( + expression, + newStatement, + collectCompilerData(expression, messageTemplate), + ) + newStatement + } + "at", + "atTrace", + "atDebug", + "atInfo", + "atWarn", + "atError" -> { + val messageTemplate = collectMessageTemplateFromAtStatement(expression) + injectCompilerOptionsIntoAtStatement( + expression, + expression, + collectCompilerData(expression, messageTemplate), + ) + expression + } + "entry", + "exit" -> { + if (!config.disableTransformingEntryExitApi) { + createOverloadedFunctionCall(expression) + } else { + return super.visitCall(expression) + } + } + "throwing", + "catching" -> { + if (!config.disableTransformingThrowingCatchingApi) { + createOverloadedFunctionCall(expression) + } else { + super.visitCall(expression) + } + } + else -> { + return super.visitCall(expression) + } + } + return newExpr + } + + private fun collectCompilerData(expression: IrCall, messageTemplate: String) = + if (config.disableCollectingCallSiteInformation) { + KLoggingCallCompilerData(messageTemplate = messageTemplate) + } else { + KLoggingCallCompilerData( + messageTemplate = messageTemplate, + className = parentClass?.kotlinFqName?.asString() ?: sourceFile.defaultClassName(), + methodName = parentDeclaration?.kotlinFqName?.shortName()?.asString(), + lineNumber = + sourceFile.getSourceRangeInfo(expression).startLineNumber + + 1, // somehow, the line numbers are off by one in tests + fileName = sourceFile.fileName(), + ) + } + + data class KLoggingCallExpressions( + val levelExpression: IrExpression, + val markerExpression: IrExpression? = null, + val messageExpression: IrExpression, + val causeExpression: IrExpression? = null, + val messageTemplate: String, + ) + + data class KLoggingCallCompilerData( + val messageTemplate: String? = null, + val className: String? = null, + val methodName: String? = null, + val lineNumber: Int? = null, + val fileName: String? = null, + ) + + @OptIn(UnsafeDuringIrConstructionAPI::class) + private fun collectMessageTemplateFromAtStatement(atCall: IrCall): String { + val function = atCall.symbol.owner + var messageExpression: IrExpression? = null + function.valueParameters.forEachIndexed { index, parameter -> + if ( + parameter.type.classifierOrFail == typesHelper.eventBuilderLambdaType.classifierOrFail + ) { + val eventBuilderLambdaArgument = atCall.valueArguments[index] as IrFunctionExpression + val eventBuilderLambdaBody = eventBuilderLambdaArgument.function.body!! + eventBuilderLambdaBody.statements.forEach { statement -> + if (statement is IrCall && statement.symbol == typesHelper.setMessageFunction) { + messageExpression = statement.valueArguments[0] + } + } + } + } + + return sourceFile.getText(messageExpression!!) + } + + @OptIn(UnsafeDuringIrConstructionAPI::class) + private fun injectCompilerOptionsIntoAtStatement( + originalLogExpression: IrCall, + atCall: IrCall, + compilerData: KLoggingCallCompilerData, + ) { + val symbol = currentScope!!.scope.scopeOwnerSymbol + val builder = + DeclarationIrBuilder( + context, + symbol, + originalLogExpression.startOffset, + originalLogExpression.endOffset, + ) + val eventBuilderLambdaArgument = atCall.valueArguments.last() as IrFunctionExpression + val eventBuilderLambdaBody = eventBuilderLambdaArgument.function.body!! + (eventBuilderLambdaBody.statements as MutableList).add( + builder.irCall(typesHelper.setInternalCompilerDataFunction.owner).apply { + dispatchReceiver = + IrGetValueImpl( + startOffset = UNDEFINED_OFFSET, + endOffset = UNDEFINED_OFFSET, + symbol = eventBuilderLambdaArgument.function.extensionReceiverParameter!!.symbol, + ) + putValueArgument(0, makeCompilerDataConstructorCall(compilerData, builder)) + } + ) + } + + private fun makeCompilerDataConstructorCall( + compilerData: KLoggingCallCompilerData, + builder: DeclarationIrBuilder, + ): IrConstructorCall { + return typesHelper.internalCompilerDataConstructor.toIrConstructorCall().apply { + putValueArgument(0, compilerData.messageTemplate?.let { builder.irString(it) }) + putValueArgument(1, compilerData.className?.let { builder.irString(it) }) + putValueArgument(2, compilerData.methodName?.let { builder.irString(it) }) + putValueArgument(3, compilerData.lineNumber?.let { builder.irInt(it) }) + putValueArgument(4, compilerData.fileName?.let { builder.irString(it) }) + } + } + + @OptIn(UnsafeDuringIrConstructionAPI::class) + private fun createOverloadedFunctionCall(originalLogExpression: IrCall): IrExpression { + val symbol = currentScope!!.scope.scopeOwnerSymbol + val builder = + DeclarationIrBuilder( + context, + symbol, + originalLogExpression.startOffset, + originalLogExpression.endOffset, + ) + val loggerExpression = originalLogExpression.dispatchReceiver!! + val originalFunction = originalLogExpression.symbol.owner + val functionName = originalFunction.name.toString() + val overloadedFunction = + findKLoggerExtensionFunction(functionName) { + it.valueParameters.size == originalFunction.valueParameters.size + 1 && + it.valueParameters.first().type.classifierOrFail == + typesHelper.internalCompilerDataClassSymbol.defaultType.classifierOrFail + } + val firstArgument = + if (originalLogExpression.valueArguments.isNotEmpty()) { + originalLogExpression.valueArguments[0] + } else { + null + } + val compilerData = + collectCompilerData( + originalLogExpression, + functionName + + (if (firstArgument != null) "(${sourceFile.getText(firstArgument)})" else ""), + ) + return builder.irCall(overloadedFunction).apply { + extensionReceiver = loggerExpression + putValueArgument(0, makeCompilerDataConstructorCall(compilerData, builder)) + originalLogExpression.valueArguments.forEachIndexed { index, exp -> + putValueArgument(index + 1, exp) + } + } + } + + @OptIn(UnsafeDuringIrConstructionAPI::class) + private fun createAtStatement(originalLogExpression: IrCall): Pair { + val symbol = currentScope!!.scope.scopeOwnerSymbol + val builder = + DeclarationIrBuilder( + context, + symbol, + originalLogExpression.startOffset, + originalLogExpression.endOffset, + ) + val loggingCallExpressions = getExpressionsFromOriginalCode(originalLogExpression) + + val loggerExpression = originalLogExpression.dispatchReceiver!! + val atFunction = + loggerExpression.type.classOrFail.owner.functions.single { + it.name == typesHelper.atMethodName && + sameParameters( + it.valueParameters, + listOf( + typesHelper.levelClassSymbol.defaultType, + typesHelper.markerClassSymbol.createType(true, listOf()), + typesHelper.eventBuilderLambdaType, + ), + ) + } + return Pair( + builder.irCall(atFunction).apply { + dispatchReceiver = loggerExpression + putValueArgument(0, loggingCallExpressions.levelExpression) + putValueArgument(1, loggingCallExpressions.markerExpression) + putValueArgument( + 2, + createIrFunctionExpression( + type = typesHelper.eventBuilderLambdaType, + function = + context.createLambdaIrSimpleFunction { + extensionReceiverParameter = + factory + .createValueParameter( + startOffset = UNDEFINED_OFFSET, + endOffset = UNDEFINED_OFFSET, + origin = IrDeclarationOrigin.DEFINED, + name = typesHelper.extensionReceiverParameterName, + type = typesHelper.eventBuilderClassSymbol.defaultType, + isAssignable = false, + symbol = IrValueParameterSymbolImpl(), + index = UNDEFINED_PARAMETER_INDEX, + varargElementType = null, + isCrossinline = false, + isNoinline = false, + isHidden = false, + ) + .apply { parent = this@createLambdaIrSimpleFunction } + returnType = typesHelper.unitType + parent = parentDeclaration!! + body = + context.createIrBlockBody { + statements.add( + builder.irCall(typesHelper.setMessageFunction.owner).apply { + dispatchReceiver = + IrGetValueImpl( + startOffset = UNDEFINED_OFFSET, + endOffset = UNDEFINED_OFFSET, + symbol = extensionReceiverParameter!!.symbol, + ) + parent = parentDeclaration!! + putValueArgument(0, loggingCallExpressions.messageExpression) + } + ) + if (loggingCallExpressions.causeExpression != null) { + statements.add( + builder.irCall(typesHelper.setCauseFunction.owner).apply { + dispatchReceiver = + IrGetValueImpl( + startOffset = UNDEFINED_OFFSET, + endOffset = UNDEFINED_OFFSET, + symbol = extensionReceiverParameter!!.symbol, + ) + parent = parentDeclaration!! + putValueArgument(0, loggingCallExpressions.causeExpression) + } + ) + } + } + }, + origin = IrStatementOrigin.LAMBDA, + ), + ) + } as IrCall, + loggingCallExpressions.messageTemplate, + ) + } + + @OptIn(UnsafeDuringIrConstructionAPI::class) + private fun getExpressionsFromOriginalCode(originalLogExpression: IrCall) = + if ( + originalLogExpression.symbol.owner.valueParameters.last().type.classifierOrFail == + typesHelper.messageBuilderLambdaType.classifierOrFail + ) { + getExpressionsFromCodeWithMessageBuilder(originalLogExpression) + } else { + getExpressionsFromCodeWithMessage(originalLogExpression) + } + + @OptIn(UnsafeDuringIrConstructionAPI::class) + private fun getExpressionsFromCodeWithMessage( + originalLogExpression: IrCall + ): KLoggingCallExpressions { + val symbol = currentScope!!.scope.scopeOwnerSymbol + val builder = + DeclarationIrBuilder( + context, + symbol, + originalLogExpression.startOffset, + originalLogExpression.endOffset, + ) + val function = originalLogExpression.symbol.owner + val functionParameters = function.valueParameters + var markerExpression: IrExpression? = null + val messageExpression: IrExpression? + val originalMessageExpression: IrExpression? + var causeExpression: IrExpression? = null + if ( + functionParameters.last().type.classifierOrFail == + typesHelper.throwableType.classifierOrFail + ) { + // arguments: message, throwable + // arguments: marker, message, throwable + causeExpression = originalLogExpression.valueArguments.last() + } + when (functionParameters.first().type.classifierOrFail) { + typesHelper.markerType.classifierOrFail -> { + markerExpression = originalLogExpression.valueArguments[0] + originalMessageExpression = originalLogExpression.valueArguments[1] + if (causeExpression != null) { + // arguments: marker, message, throwable + messageExpression = originalLogExpression.valueArguments[1] + } else { + if (functionParameters.size == 2) { + // arguments: marker, message + messageExpression = originalLogExpression.valueArguments[1] + } else { + // arguments: marker, message, arg - not supported by KLogger API + // arguments: marker, message, arg1, arg2 - not supported by KLogger API + // arguments: marker, message, vararg - not supported by KLogger API + val messageExpressionResult = + createMessageExpressionByReplacingPlaceholders(builder, originalLogExpression, 1) + messageExpression = messageExpressionResult.newExpression + causeExpression = messageExpressionResult.causeExpression + } + } + } + typesHelper.stringType.classifierOrFail -> { + originalMessageExpression = originalLogExpression.valueArguments.first() + if (causeExpression != null || functionParameters.size == 1) { + // arguments: message + // arguments: message, throwable + messageExpression = originalLogExpression.valueArguments[0] + } else { + // arguments: message, arg - not supported by KLogger API + // arguments: message, arg1, arg2 - not supported by KLogger API + // arguments: message, vararg - not supported by KLogger API + val messageExpressionResult = + createMessageExpressionByReplacingPlaceholders(builder, originalLogExpression, 0) + messageExpression = messageExpressionResult.newExpression + causeExpression = messageExpressionResult.causeExpression + } + } + else -> + error("Unsupported log statement first argument type: ${functionParameters.first().type}") + } + return KLoggingCallExpressions( + levelExpression = getLevelEnumExpression(function.name.asString().toUpperCaseAsciiOnly()), + markerExpression = markerExpression, + messageExpression = messageExpression!!, + causeExpression = causeExpression, + messageTemplate = sourceFile.getText(originalMessageExpression!!), + ) + } + + @OptIn(UnsafeDuringIrConstructionAPI::class) + private fun getLevelEnumExpression(levelString: String): IrGetEnumValue { + val levelEnumEntry = typesHelper.levelClassSymbol.owner.enumEntry(levelString) + val levelExpression = + typesHelper.levelClassSymbol.createType(false, listOf()).toIrGetEnumValue(levelEnumEntry!!) + return levelExpression + } + + @OptIn(UnsafeDuringIrConstructionAPI::class) + private fun getExpressionsFromCodeWithMessageBuilder( + originalLogExpression: IrCall + ): KLoggingCallExpressions { + // arguments: messageBuilder + // arguments: cause, messageBuilder + // arguments: cause, marker, messageBuilder + // arguments: marker, messageBuilder + // arguments: marker, cause, messageBuilder + val symbol = currentScope!!.scope.scopeOwnerSymbol + val builder = + DeclarationIrBuilder( + context, + symbol, + originalLogExpression.startOffset, + originalLogExpression.endOffset, + ) + val function = originalLogExpression.symbol.owner + var markerExpression: IrExpression? = null + var messageExpression: IrExpression? = null + var causeExpression: IrExpression? = null + val originalMessageExpression = + originalLogExpression.valueArguments.last() as IrFunctionExpression + val messageTemplate = + originalMessageExpression.function.body?.let { sourceFile.getText(it) }!! + + function.valueParameters.forEachIndexed { index, parameter -> + if ( + parameter.type.classifierOrFail == typesHelper.messageBuilderLambdaType.classifierOrFail + ) { + messageExpression = + builder.irCall(typesHelper.toStringFunctionSymbol).apply { + extensionReceiver = originalLogExpression.valueArguments[index] + } + } else { + if (parameter.type.classifierOrFail == typesHelper.throwableType.classifierOrFail) { + causeExpression = originalLogExpression.valueArguments[index] + } else { + if (parameter.type.classifierOrFail == typesHelper.markerType.classifierOrFail) { + markerExpression = originalLogExpression.valueArguments[index] + } + } + } + } + return KLoggingCallExpressions( + levelExpression = getLevelEnumExpression(function.name.asString().toUpperCaseAsciiOnly()), + markerExpression = markerExpression, + messageExpression = messageExpression!!, + causeExpression = causeExpression, + messageTemplate = messageTemplate, + ) + } + + data class MessageExpressionResult( + val newExpression: IrExpression, + val causeExpression: IrExpression?, + ) + + private fun createMessageExpressionByReplacingPlaceholders( + builder: DeclarationIrBuilder, + originalLogExpression: IrCall, + messageArgumentIndex: Int, + ): MessageExpressionResult { + val replaceResult: ReplaceResult + var causeExpression: IrExpression? = null + if (originalLogExpression.valueArguments[messageArgumentIndex + 1] is IrVararg) { + val varArgs = + (originalLogExpression.valueArguments[messageArgumentIndex + 1] as IrVararg) + .elements + .toList() + replaceResult = + replacePlaceholders( + builder, + originalLogExpression.valueArguments[messageArgumentIndex], + varArgs, + 0, + "{}", + ) + if (replaceResult.newArgIndex < varArgs.size) { + causeExpression = + builder.irCall(typesHelper.castToThrowableFunctionSymbol).apply { + extensionReceiver = varArgs.last() as IrExpression? + } + } + } else { + replaceResult = + replacePlaceholders( + builder, + originalLogExpression.valueArguments[messageArgumentIndex], + originalLogExpression.valueArguments, + messageArgumentIndex + 1, + "{}", + ) + if (replaceResult.newArgIndex < originalLogExpression.valueArguments.size) { + causeExpression = + builder.irCall(typesHelper.castToThrowableFunctionSymbol).apply { + extensionReceiver = originalLogExpression.valueArguments.last() + } + } + } + return MessageExpressionResult(replaceResult.newExpression, causeExpression) + } + + data class ReplaceResult(val newExpression: IrExpression, val newArgIndex: Int) + + private fun replacePlaceholders( + builder: DeclarationIrBuilder, + msgExp: IrExpression?, + valueArguments: List, + currentArgIndex: Int, + placeholder: String, + ): ReplaceResult { + var newArgIndex = currentArgIndex + if (msgExp is IrConst<*>) { + val value = msgExp.value + if (value is String && value.contains(placeholder)) { + val pair = + replacePlaceholdersInStringConstant( + builder, + value, + valueArguments, + newArgIndex, + placeholder, + ) + val newExpression = pair.first + newArgIndex = pair.second + return ReplaceResult(newExpression!!, newArgIndex) + } + } else if (msgExp is IrCall) { + val dispatchResult = + replacePlaceholders( + builder, + msgExp.dispatchReceiver, + valueArguments, + newArgIndex, + placeholder, + ) + msgExp.dispatchReceiver = dispatchResult.newExpression + newArgIndex = dispatchResult.newArgIndex + msgExp.valueArguments.forEachIndexed { index, valueArgument -> + val argResult = + replacePlaceholders(builder, valueArgument, valueArguments, newArgIndex, placeholder) + msgExp.putValueArgument(index, argResult.newExpression) + newArgIndex = argResult.newArgIndex + } + } else { + error("Unknown message expression: $msgExp") + } + return ReplaceResult(msgExp, newArgIndex) + } + + private fun replacePlaceholdersInStringConstant( + builder: DeclarationIrBuilder, + msg: String, + valueArguments: List, + currentArgIndex: Int, + placeholder: String, + ): Pair { + val plusFunctionSymbol = context.irBuiltIns.extensionStringPlus + var newArgIndex = currentArgIndex + if (msg == placeholder) { + return Pair( + if (valueArguments.size > newArgIndex) valueArguments[newArgIndex++] as IrExpression + else builder.irString(placeholder), + newArgIndex, + ) + } + val msgParts = msg.split(placeholder) + val newExpression = + msgParts.foldIndexed(null as IrExpression?) { index, accumulator, msgPart -> + if (index < msgParts.size - 1) { + val arg = + if (valueArguments.size > newArgIndex) valueArguments[newArgIndex++] + else builder.irString(placeholder) + if (index == 0) { + // first element + builder.irCall(plusFunctionSymbol).apply { + dispatchReceiver = builder.irString(msgPart) + putValueArgument(0, arg!! as IrExpression) + } + } else { + // in-between elements + builder.irCall(plusFunctionSymbol).apply { + dispatchReceiver = accumulator + putValueArgument( + 0, + builder.irCall(plusFunctionSymbol).apply { + dispatchReceiver = builder.irString(msgPart) + putValueArgument(0, arg!! as IrExpression) + }, + ) + } + } + } else { + // last element + builder.irCall(plusFunctionSymbol).apply { + dispatchReceiver = accumulator + putValueArgument(0, builder.irString(msgPart)) + } + } + } + return Pair(newExpression, newArgIndex) + } + + private fun sameParameters( + valueParameters: List, + valueArguments: List, + ): Boolean { + if (valueParameters.size != valueArguments.size) return false + for (i in valueParameters.indices) { + if (valueParameters[i].type.classifierOrFail != valueArguments[i].classifierOrFail) + return false + } + return true + } + } +} + +@OptIn(UnsafeDuringIrConstructionAPI::class) +private fun IrCall.isNotImplementedKLoggerApiCall( + typesHelper: KotlinLoggingIrGenerationExtension.TypesHelper +): Boolean { + val function = symbol.owner + val functionParameters = function.valueParameters + if ( + functionParameters.any { + it.type.classifierOrFail == typesHelper.throwableType.classifierOrFail + } + ) { + // arguments: message, throwable + // arguments: marker, message, throwable + // arguments: marker, throwable, message builder + return false + } + if (functionParameters.size > 2) { + // arguments: marker, message, arg - not supported by KLogger API + // arguments: marker, message, arg1, arg2 - not supported by KLogger API + // arguments: marker, message, vararg - not supported by KLogger API + // arguments: message, arg1, arg2 - not supported by KLogger API + return true + } + if ( + functionParameters.size > 1 && + functionParameters.first().type.classifierOrFail == typesHelper.stringType.classifierOrFail + ) { + // arguments: message, arg - not supported by KLogger API + // arguments: message, vararg - not supported by KLogger API + return true + } + return false +} + +@OptIn(UnsafeDuringIrConstructionAPI::class) +fun IrClass.enumEntry(enumName: String): IrEnumEntry? = + if (isEnumClass) { + declarations.filterIsInstance().firstOrNull { enumEntry -> + "${enumEntry.name}" == enumName + } + } else null + +fun FileLoweringPass.runOnFileInOrder(irFile: IrFile) { + irFile.acceptVoid( + object : IrElementVisitorVoid { + override fun visitElement(element: IrElement) { + element.acceptChildrenVoid(this) + } + + override fun visitFile(declaration: IrFile) { + lower(declaration) + declaration.acceptChildrenVoid(this) + } + } + ) +} diff --git a/kotlin-ir-plugin/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingIrPluginConfig.kt b/kotlin-ir-plugin/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingIrPluginConfig.kt new file mode 100644 index 00000000..5a1a86b4 --- /dev/null +++ b/kotlin-ir-plugin/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingIrPluginConfig.kt @@ -0,0 +1,10 @@ +package io.github.oshai.kotlinlogging.irplugin + +data class KotlinLoggingIrPluginConfig( + val disableAll: Boolean = false, + val disableTransformingDeprecatedApi: Boolean = false, + val disableTransformingNotImplementedApi: Boolean = false, + val disableTransformingEntryExitApi: Boolean = false, + val disableTransformingThrowingCatchingApi: Boolean = false, + val disableCollectingCallSiteInformation: Boolean = false, +) diff --git a/kotlin-ir-plugin/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/SourceFile.kt b/kotlin-ir-plugin/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/SourceFile.kt new file mode 100644 index 00000000..71bba877 --- /dev/null +++ b/kotlin-ir-plugin/src/main/kotlin/io/github/oshai/kotlinlogging/irplugin/SourceFile.kt @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2020 Brian Norman + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.github.oshai.kotlinlogging.irplugin + +import java.io.File +import org.jetbrains.kotlin.ir.IrElement +import org.jetbrains.kotlin.ir.SourceRangeInfo +import org.jetbrains.kotlin.ir.declarations.IrFile +import org.jetbrains.kotlin.ir.declarations.name +import org.jetbrains.kotlin.ir.declarations.path +import org.jetbrains.kotlin.ir.expressions.IrCall +import org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI +import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeAsciiOnly + +// Copied from +// https://github.com/bnorm/kotlin-power-assert/blob/master/kotlin-power-assert-plugin/src/main/kotlin/com/bnorm/power/diagram/SourceFile.kt +data class SourceFile(private val irFile: IrFile) { + private val source: String = + File(irFile.path) + .readText() + .replace("\r\n", "\n") // https://youtrack.jetbrains.com/issue/KT-41888 + + @OptIn(UnsafeDuringIrConstructionAPI::class) + fun getSourceRangeInfo(element: IrElement): SourceRangeInfo { + var range = element.startOffset..element.endOffset + when (element) { + is IrCall -> { + val receiver = element.extensionReceiver ?: element.dispatchReceiver + if (element.symbol.owner.isInfix && receiver != null) { + // When an infix function is called *not* with infix notation, the startOffset will not + // include the receiver. + // Force the range to include the receiver, so it is always present + range = receiver.startOffset..element.endOffset + + // The offsets of the receiver will *not* include surrounding parentheses so these need to + // be checked for + // manually. + val substring = safeSubstring(receiver.startOffset - 1, receiver.endOffset + 1) + if (substring.startsWith('(') && substring.endsWith(')')) { + range = receiver.startOffset - 1..element.endOffset + } + } + } + } + return irFile.fileEntry.getSourceRangeInfo(range.first, range.last) + } + + fun getText(element: IrElement) = getText(getSourceRangeInfo(element)) + + private fun getText(info: SourceRangeInfo): String { + return safeSubstring(info.startOffset, info.endOffset) + } + + private fun safeSubstring(start: Int, end: Int): String = + source.substring(maxOf(start, 0), minOf(end, source.length)) + + fun fileName() = irFile.name + + fun defaultClassName() = + irFile.packageFqName.toString() + + "." + + irFile.name.capitalizeAsciiOnly().substringBefore(".kt") + + "Kt" +} diff --git a/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/CompiledTest.kt b/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/CompiledTest.kt new file mode 100644 index 00000000..ec72c2e3 --- /dev/null +++ b/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/CompiledTest.kt @@ -0,0 +1,77 @@ +package io.github.oshai.kotlinlogging.irplugin + +import ch.qos.logback.classic.Level +import ch.qos.logback.classic.Logger +import ch.qos.logback.classic.spi.ILoggingEvent +import io.github.oshai.kotlinlogging.logback.internal.LogbackLoggerFactory +import java.lang.reflect.InvocationTargetException + +data class CompiledTest( + val preparedTest: PreparedTest, + val classLoader: ClassLoader, + val expectedExecutionResult: TestExecutionResult, +) : TestLeaf by preparedTest { + + override fun toMarkDownDocument(): String { + val transformed = prepareTransformed() + return """ + |### ${preparedTest.testCode.testName} test + | + |User code: + |```kotlin + |${preparedTest.testCode.sourceCode.text} + |``` + + |${if (preparedTest.testCode.sourceCode.text == transformed?.sourceCode?.text || transformed == null) "Remains as-is" else "Transformed into"}: + |```kotlin + |${transformed?.sourceCode?.text ?: preparedTest.testCode.sourceCode.text} + |``` + """ + .trimMargin() + } + + fun execute(): ExecutedTest { + val compiledClass = classLoader.loadClass(preparedTest.testCode.fqClassName) + var returnedValue: Any? = null + var thrownException: Throwable? = null + + val appender = configureLogging() + val instance = + if (preparedTest.testCode.needsInstance) compiledClass.getDeclaredConstructor().newInstance() + else null + try { + returnedValue = compiledClass.getMethod(preparedTest.testCode.funName).invoke(instance) + } catch (ite: InvocationTargetException) { + thrownException = ite.cause + } + + return ExecutedTest( + compiledTest = this, + actualExecutionResult = + TestExecutionResult( + returnedValue = returnedValue, + thrownExceptionToString = thrownException?.toString(), + loggedEvent = if (appender.events.isNotEmpty()) appender.events.single() else null, + ), + ) + } + + private fun configureLogging(): EventCollectingLogbackAppender { + System.setProperty("kotlin-logging-to-logback", "true") + val loggerContext = LogbackLoggerFactory.getLoggerContext() + loggerContext.reset() + val appender = EventCollectingLogbackAppender() + appender.name = "EventCollectingLogbackAppender" + appender.context = loggerContext + appender.start() + + val rootLogger = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME) + rootLogger.addAppender(appender) + rootLogger.level = Level.TRACE + return appender + } + + fun prepareTransformed(): PreparedTestCode? { + return preparedTest.prepareTransformed(expectedExecutionResult) + } +} diff --git a/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/EventCollectingLogbackAppender.kt b/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/EventCollectingLogbackAppender.kt new file mode 100644 index 00000000..f5f846d1 --- /dev/null +++ b/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/EventCollectingLogbackAppender.kt @@ -0,0 +1,24 @@ +package io.github.oshai.kotlinlogging.irplugin + +import ch.qos.logback.classic.spi.ILoggingEvent +import ch.qos.logback.core.AppenderBase + +class EventCollectingLogbackAppender : AppenderBase() { + + val events = mutableListOf() + + override fun append(event: T) { + events.add( + TestLoggingEvent( + level = TestLoggingLevel.valueOf(event.level.levelStr), + message = event.message, + formattedMessage = event.formattedMessage, + hasMarker = event.markerList != null && event.markerList.isNotEmpty(), + hasThrowable = event.throwableProxy != null, + callerDataFirstElement = + if (event.callerData != null && event.callerData.isNotEmpty()) event.callerData[0] + else null, + ) + ) + } +} diff --git a/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/ExecutedTest.kt b/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/ExecutedTest.kt new file mode 100644 index 00000000..caa796fb --- /dev/null +++ b/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/ExecutedTest.kt @@ -0,0 +1,106 @@ +package io.github.oshai.kotlinlogging.irplugin + +import kotlin.test.assertEquals +import org.junit.jupiter.api.Assertions.fail +import org.junit.jupiter.api.function.Executable + +class ExecutedTest(val compiledTest: CompiledTest, val actualExecutionResult: TestExecutionResult) : + TestLeaf by compiledTest { + + fun assertResults() = assertResult(compiledTest.expectedExecutionResult, actualExecutionResult) +} + +private fun assertResult( + expectedExecutionResult: TestExecutionResult, + actualExecutionResult: TestExecutionResult, +): List { + val assertions = mutableListOf() + assertions.add( + Executable { + assertEquals( + expectedExecutionResult.returnedValue, + actualExecutionResult.returnedValue, + "returned value", + ) + } + ) + assertions.add( + Executable { + assertEquals( + expectedExecutionResult.thrownExceptionToString, + actualExecutionResult.thrownExceptionToString, + "thrown exception", + ) + } + ) + assertions.addAll( + assertLoggedEvent(expectedExecutionResult.loggedEvent, actualExecutionResult.loggedEvent) + ) + return assertions +} + +private fun assertLoggedEvent( + expectedTestLoggingEvent: TestLoggingEvent?, + actualTestLoggingEvent: TestLoggingEvent?, +): List { + val assertions = mutableListOf() + if (expectedTestLoggingEvent != null && actualTestLoggingEvent != null) { + assertions.add( + Executable { + assertEquals(expectedTestLoggingEvent.level, actualTestLoggingEvent.level, "level") + } + ) + assertions.add( + Executable { + assertEquals(expectedTestLoggingEvent.message, actualTestLoggingEvent.message, "message") + } + ) + assertions.add( + Executable { + assertEquals( + expectedTestLoggingEvent.formattedMessage, + actualTestLoggingEvent.formattedMessage, + "formatted message", + ) + } + ) + assertions.add( + Executable { + assertEquals( + expectedTestLoggingEvent.hasMarker, + actualTestLoggingEvent.hasMarker, + "has marker", + ) + } + ) + assertions.add( + Executable { + assertEquals( + expectedTestLoggingEvent.hasThrowable, + actualTestLoggingEvent.hasThrowable, + "has throwable", + ) + } + ) + assertions.add( + Executable { + assertEquals( + expectedTestLoggingEvent.callerDataFirstElement, + actualTestLoggingEvent.callerDataFirstElement, + "caller data", + ) + } + ) + } + if (expectedTestLoggingEvent != null && actualTestLoggingEvent == null) { + assertions.add( + Executable { fail("Expected logged event ($expectedTestLoggingEvent) but none was logged") } + ) + } + if (expectedTestLoggingEvent == null && actualTestLoggingEvent != null) { + assertions.add( + Executable { fail("Did not expect an event to be logged: $actualTestLoggingEvent") } + ) + } + return assertions +} diff --git a/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/FeatureFlag.kt b/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/FeatureFlag.kt new file mode 100644 index 00000000..ad72ea07 --- /dev/null +++ b/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/FeatureFlag.kt @@ -0,0 +1,62 @@ +package io.github.oshai.kotlinlogging.irplugin + +enum class FeatureFlag( + val configurer: () -> KotlinLoggingIrPluginConfig, + val expectationAdjuster: TestExecutionResultBuilder.() -> Unit, +) { + DEFAULT({ KotlinLoggingIrPluginConfig() }, {}), + DISABLE_ALL( + { KotlinLoggingIrPluginConfig(disableAll = true) }, + { + loggedEvent { + message = formattedMessage + callerDataFirstElement = null + } + }, + ), + DISABLE_TRANSFORMING_NOT_IMPLEMENTED_API( + { KotlinLoggingIrPluginConfig(disableTransformingNotImplementedApi = true) }, + {}, + ), + DISABLE_TRANSFORMING_DEPRECATED_API( + { KotlinLoggingIrPluginConfig(disableTransformingDeprecatedApi = true) }, + {}, + ), + DISABLE_TRANSFORMING_ENTRY_EXIT_API( + { KotlinLoggingIrPluginConfig(disableTransformingEntryExitApi = true) }, + {}, + ), + DISABLE_TRANSFORMING_THROWING_CATCHING_API( + { KotlinLoggingIrPluginConfig(disableTransformingThrowingCatchingApi = true) }, + {}, + ), + DISABLE_COLLECTING_CALL_SITE_INFORMATION( + { KotlinLoggingIrPluginConfig(disableCollectingCallSiteInformation = true) }, + { loggedEvent { callerDataFirstElement = null } }, + ), +} + +data class FeatureFlagExpectationAdjuster( + val applicableFeatureFlags: Set, + val expectationAdjuster: TestExecutionResultBuilder.() -> Unit, +) + +class FeatureFlagExpectationAdjusterBuilder { + private val applicableFeatureFlags: MutableSet = mutableSetOf() + private var expectationAdjuster: (TestExecutionResultBuilder.() -> Unit)? = null + + fun featureFlags(vararg flags: FeatureFlag) { + applicableFeatureFlags.addAll(flags) + } + + fun adjuster(block: TestExecutionResultBuilder.() -> Unit) { + expectationAdjuster = block + } + + fun build(): FeatureFlagExpectationAdjuster { + return FeatureFlagExpectationAdjuster( + applicableFeatureFlags = applicableFeatureFlags, + expectationAdjuster = expectationAdjuster!!, + ) + } +} diff --git a/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingIrGenerationExtensionTest.kt b/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingIrGenerationExtensionTest.kt new file mode 100644 index 00000000..4817eea8 --- /dev/null +++ b/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/KotlinLoggingIrGenerationExtensionTest.kt @@ -0,0 +1,684 @@ +package io.github.oshai.kotlinlogging.irplugin + +import io.github.oshai.kotlinlogging.KLogger +import java.io.File +import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeAsciiOnly +import org.jetbrains.kotlin.util.capitalizeDecapitalize.toUpperCaseAsciiOnly +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.DynamicContainer +import org.junit.jupiter.api.DynamicNode +import org.junit.jupiter.api.DynamicTest +import org.junit.jupiter.api.TestFactory + +const val MARKER_PLACEHOLDER = "{marker}" +const val MARKER_VARIABLE_NAME = "marker" +const val THROWABLE_PLACEHOLDER = "{throwable}" +const val THROWABLE_VARIABLE_NAME = "throwable" +const val EXCEPTION_MESSAGE = "expected!" + +class KotlinLoggingIrGenerationExtensionTest { + + private val testDefinitions = rootCollection { + name = "root" + sequenceOf(true, false).forEach { withClass -> + collection { + name = "with class=$withClass" + collection { + name = "entry/exit API" + featureFlagExpectationAdjuster { + featureFlags(FeatureFlag.DISABLE_TRANSFORMING_ENTRY_EXIT_API) + adjuster { + loggedEvent { + message = formattedMessage + callerDataFirstElement = null + } + } + } + test { + code { + useClass = withClass + useThrowable = false + useMarker = false + initCode = "val argument1 = 42; val argument2 = true" + logStatement = + LogStatement(funName = "entry", arguments = listOf("argument1", "argument2")) + } + expect { + loggedEvent { + level = TestLoggingLevel.TRACE + message = "entry(argument1, argument2)" + formattedMessage = "entry(42, true)" + hasMarker = false + hasThrowable = false + } + } + } + test { + code { + useClass = withClass + useThrowable = false + useMarker = false + initCode = "val resultValue = 42" + funReturnType = Int::class + logStatement = LogStatement(funName = "exit", arguments = listOf("resultValue")) + } + expect { + returnedValue = 42 + loggedEvent { + level = TestLoggingLevel.TRACE + message = "exit(resultValue)" + formattedMessage = "exit(42)" + hasMarker = false + hasThrowable = false + } + } + } + test { + code { + useClass = withClass + useThrowable = false + useMarker = false + logStatement = LogStatement(funName = "exit") + } + expect { + loggedEvent { + level = TestLoggingLevel.TRACE + message = "exit" + formattedMessage = "exit" + hasMarker = false + hasThrowable = false + } + } + } + } + collection { + name = "throwing/catching API" + featureFlagExpectationAdjuster { + featureFlags(FeatureFlag.DISABLE_TRANSFORMING_THROWING_CATCHING_API) + adjuster { + loggedEvent { + message = formattedMessage + callerDataFirstElement = null + } + } + } + test { + code { + useClass = withClass + useThrowable = true + useMarker = false + logStatement = + LogStatement(funName = "throwing", arguments = listOf(THROWABLE_PLACEHOLDER)) + throwReturnValueFromLogStatement = true + } + expect { + thrownExceptionToString = "java.lang.Exception: expected!" + loggedEvent { + level = TestLoggingLevel.ERROR + message = "throwing(throwable)" + formattedMessage = "throwing(java.lang.Exception: expected!)" + hasMarker = false + hasThrowable = true + } + } + } + test { + code { + useClass = withClass + useThrowable = true + useMarker = false + logStatement = + LogStatement(funName = "catching", arguments = listOf(THROWABLE_PLACEHOLDER)) + } + expect { + loggedEvent { + level = TestLoggingLevel.ERROR + message = "catching(throwable)" + formattedMessage = "catching(java.lang.Exception: expected!)" + hasMarker = false + hasThrowable = true + } + } + } + } + TestLoggingLevel.entries.forEach { withLogLevel -> + collection { + name = "with log level=${withLogLevel.levelEnum}" + sequenceOf(true, false).forEach { withThrowable -> + collection { + name = "with throwable=$withThrowable" + sequenceOf(true, false).forEach { withMarker -> + collection { + name = "with marker=$withMarker" + test { + skip = + (withMarker && + !withThrowable) // skip variant with only marker and message builder -- + // that is handled in deprecated API container + code { + useClass = withClass + useThrowable = withThrowable + useMarker = withMarker + logStatement = + LogStatement( + funName = withLogLevel.levelName, + arguments = listOf(THROWABLE_PLACEHOLDER, MARKER_PLACEHOLDER), + lastArgumentLambda = """ "${withLogLevel.levelName} messageBuilder" """, + ) + } + expect { + loggedEvent { + level = withLogLevel + message = "\"${withLogLevel.levelName} messageBuilder\"" + formattedMessage = "${withLogLevel.levelName} messageBuilder" + hasMarker = withMarker + hasThrowable = withThrowable + } + } + } + test { + skip = + (withMarker && + !withThrowable) // skip variant with only marker and message builder -- + // that is handled in deprecated API container + code { + useClass = withClass + useThrowable = withThrowable + useMarker = withMarker + initCode = "val i = 42" + logStatement = + LogStatement( + funName = withLogLevel.levelName, + arguments = listOf(THROWABLE_PLACEHOLDER, MARKER_PLACEHOLDER), + lastArgumentLambda = + """ "${withLogLevel.levelName} messageBuilder ${expression("i")}" """, + ) + } + expect { + loggedEvent { + level = withLogLevel + message = + "\"${withLogLevel.levelName} messageBuilder ${expression("i")}\"" + formattedMessage = "${withLogLevel.levelName} messageBuilder 42" + hasMarker = withMarker + hasThrowable = withThrowable + } + } + } + test { + skip = + (withMarker && + !withThrowable) // skip variant with only marker and message builder -- + // that is handled in deprecated API container + code { + useClass = withClass + useThrowable = withThrowable + useMarker = withMarker + initCode = "val i = 42" + logStatement = + LogStatement( + funName = withLogLevel.levelName, + arguments = listOf(THROWABLE_PLACEHOLDER, MARKER_PLACEHOLDER), + lastArgumentLambda = + """ "${withLogLevel.levelName} messageBuilder ${expression("i")} ${expression("helper()")}" """, + ) + extraMethodCode = """fun helper() = "Hello!"""" + } + expect { + loggedEvent { + level = withLogLevel + message = + "\"${withLogLevel.levelName} messageBuilder ${expression("i")} ${expression("helper()")}\"" + formattedMessage = "${withLogLevel.levelName} messageBuilder 42 Hello!" + hasMarker = withMarker + hasThrowable = withThrowable + } + } + } + collection { + name = "deprecated ${KLogger::class.simpleName} API" + featureFlagExpectationAdjuster { + featureFlags(FeatureFlag.DISABLE_TRANSFORMING_DEPRECATED_API) + adjuster { + loggedEvent { + message = formattedMessage + callerDataFirstElement = null + } + } + } + test { + skip = !withMarker // skip variants without marker -- those are handled in + // non-deprecated API tests + code { + useClass = withClass + useThrowable = withThrowable + useMarker = withMarker + logStatement = + LogStatement( + funName = withLogLevel.levelName, + arguments = listOf(MARKER_PLACEHOLDER, THROWABLE_PLACEHOLDER), + lastArgumentLambda = + """ "${withLogLevel.levelName} messageBuilder" """, + ) + } + expect { + loggedEvent { + level = withLogLevel + message = "\"${withLogLevel.levelName} messageBuilder\"" + formattedMessage = "${withLogLevel.levelName} messageBuilder" + hasMarker = withMarker + hasThrowable = withThrowable + } + } + } + test { + skip = !withMarker // skip variants without marker -- those are handled in + // non-deprecated API tests + code { + useClass = withClass + useThrowable = withThrowable + useMarker = withMarker + initCode = "val i = 42" + logStatement = + LogStatement( + funName = withLogLevel.levelName, + arguments = listOf(MARKER_PLACEHOLDER, THROWABLE_PLACEHOLDER), + lastArgumentLambda = + """ "${withLogLevel.levelName} messageBuilder ${expression("i")}" """, + ) + } + expect { + loggedEvent { + level = withLogLevel + message = + "\"${withLogLevel.levelName} messageBuilder ${expression("i")}\"" + formattedMessage = "${withLogLevel.levelName} messageBuilder 42" + hasMarker = withMarker + hasThrowable = withThrowable + } + } + } + test { + skip = !withMarker // skip variants without marker -- those are handled in + // non-deprecated API tests + code { + useClass = withClass + useThrowable = withThrowable + useMarker = withMarker + initCode = "val i = 42" + logStatement = + LogStatement( + funName = withLogLevel.levelName, + arguments = listOf(MARKER_PLACEHOLDER, THROWABLE_PLACEHOLDER), + lastArgumentLambda = + """ "${withLogLevel.levelName} messageBuilder ${expression("i")} ${expression("helper()")}" """, + ) + extraMethodCode = """fun helper() = "Hello!"""" + } + expect { + loggedEvent { + level = withLogLevel + message = + "\"${withLogLevel.levelName} messageBuilder ${expression("i")} ${expression("helper()")}\"" + formattedMessage = "${withLogLevel.levelName} messageBuilder 42 Hello!" + hasMarker = withMarker + hasThrowable = withThrowable + } + } + } + test { + code { + useClass = withClass + useThrowable = withThrowable + useMarker = withMarker + logStatement = + LogStatement( + funName = withLogLevel.levelName, + arguments = + listOf( + MARKER_PLACEHOLDER, + """ "${withLogLevel.levelName} message {}" """.trim(), + THROWABLE_PLACEHOLDER, + ), + ) + } + expect { + loggedEvent { + level = withLogLevel + message = "\"${withLogLevel.levelName} message {}\"" + formattedMessage = "${withLogLevel.levelName} message {}" + hasMarker = withMarker + hasThrowable = withThrowable + } + } + } + collection { + name = "deprecated API not implemented by ${KLogger::class.simpleName}" + featureFlagExpectationAdjuster { + featureFlags( + FeatureFlag.DISABLE_ALL, + FeatureFlag.DISABLE_TRANSFORMING_NOT_IMPLEMENTED_API, + FeatureFlag.DISABLE_TRANSFORMING_DEPRECATED_API, + ) + adjuster { + loggedEvent(null) + thrownExceptionToString = + "kotlin.NotImplementedError: An operation is not implemented." + } + } + test { + code { + useClass = withClass + useThrowable = withThrowable + useMarker = withMarker + initCode = "val arg = 42" + logStatement = + LogStatement( + funName = withLogLevel.levelName, + arguments = + listOf( + MARKER_PLACEHOLDER, + """ "${withLogLevel.levelName} message {}" """.trim(), + "arg", + THROWABLE_PLACEHOLDER, + ), + ) + } + expect { + loggedEvent { + level = withLogLevel + message = "\"${withLogLevel.levelName} message {}\"" + formattedMessage = "${withLogLevel.levelName} message 42" + hasMarker = withMarker + hasThrowable = withThrowable + } + } + } + test { + code { + useClass = withClass + useThrowable = withThrowable + useMarker = withMarker + initCode = "val arg = 42" + logStatement = + LogStatement( + funName = withLogLevel.levelName, + arguments = + listOf( + MARKER_PLACEHOLDER, + """ "${withLogLevel.levelName} message {} " + "" + "{}" + "{}" + " abc" + " {}" """ + .trim(), + "arg", + "helper()", + THROWABLE_PLACEHOLDER, + ), + ) + extraMethodCode = """fun helper() = "Hello!"""" + } + expect { + loggedEvent { + level = withLogLevel + message = + """"${withLogLevel.levelName} message {} " + "" + "{}" + "{}" + " abc" + " {}"""" + formattedMessage = + if (withThrowable) + "${withLogLevel.levelName} message 42 Hello!java.lang.Exception: expected! abc {}" + else "${withLogLevel.levelName} message 42 Hello!{} abc {}" + hasMarker = withMarker + hasThrowable = false + } + } + } + test { + code { + useClass = withClass + useThrowable = withThrowable + useMarker = withMarker + initCode = "val a = 1; val b = 2" + logStatement = + LogStatement( + funName = withLogLevel.levelName, + arguments = + listOf( + MARKER_PLACEHOLDER, + """ "${withLogLevel.levelName} message {}a" + " {}b" + " {}ab" + " ab" """ + .trim(), + "a", + "b", + "ab()", + THROWABLE_PLACEHOLDER, + ), + ) + extraMethodCode = """fun ab() = 12""" + } + expect { + loggedEvent { + level = withLogLevel + message = + """"${withLogLevel.levelName} message {}a" + " {}b" + " {}ab" + " ab"""" + formattedMessage = "${withLogLevel.levelName} message 1a 2b 12ab ab" + hasMarker = withMarker + hasThrowable = withThrowable + } + } + } + } + } + test { + code { + useClass = withClass + useThrowable = withThrowable + useMarker = withMarker + logStatement = + LogStatement( + funName = "at${withLogLevel.levelName.capitalizeAsciiOnly()}", + arguments = listOf(MARKER_PLACEHOLDER), + lastArgumentLambda = + """ message="${withLogLevel.levelName} eventBuilder"; cause=$THROWABLE_PLACEHOLDER """, + ) + } + expect { + loggedEvent { + level = withLogLevel + message = "\"${withLogLevel.levelName} eventBuilder\"" + formattedMessage = "${withLogLevel.levelName} eventBuilder" + hasMarker = withMarker + hasThrowable = withThrowable + } + } + } + test { + code { + useClass = withClass + useThrowable = withThrowable + useMarker = withMarker + initCode = "val i = 42" + logStatement = + LogStatement( + funName = "at${withLogLevel.levelName.capitalizeAsciiOnly()}", + arguments = listOf(MARKER_PLACEHOLDER), + lastArgumentLambda = + """ message="${withLogLevel.levelName} eventBuilder ${expression("i")}"; cause=$THROWABLE_PLACEHOLDER """, + ) + } + expect { + loggedEvent { + level = withLogLevel + message = "\"${withLogLevel.levelName} eventBuilder ${expression("i")}\"" + formattedMessage = "${withLogLevel.levelName} eventBuilder 42" + hasMarker = withMarker + hasThrowable = withThrowable + } + } + } + test { + code { + useClass = withClass + useThrowable = withThrowable + useMarker = withMarker + initCode = "val i = 42" + logStatement = + LogStatement( + funName = "at${withLogLevel.levelName.capitalizeAsciiOnly()}", + arguments = listOf(MARKER_PLACEHOLDER), + lastArgumentLambda = + """ message="${withLogLevel.levelName} eventBuilder ${expression("i")} ${ + expression( + "helper()" + ) + }"; cause=$THROWABLE_PLACEHOLDER """, + ) + extraMethodCode = """fun helper() = "Hello!"""" + } + expect { + loggedEvent { + level = withLogLevel + message = + "\"${withLogLevel.levelName} eventBuilder ${expression("i")} ${expression("helper()")}\"" + formattedMessage = "${withLogLevel.levelName} eventBuilder 42 Hello!" + hasMarker = withMarker + hasThrowable = withThrowable + } + } + } + test { + code { + useClass = withClass + useThrowable = withThrowable + useMarker = withMarker + logStatement = + LogStatement( + funName = "at", + arguments = + listOf( + "Level.${withLogLevel.levelName.toUpperCaseAsciiOnly()}", + MARKER_PLACEHOLDER, + ), + lastArgumentLambda = + """ message="${withLogLevel.levelName} eventBuilder"; cause=$THROWABLE_PLACEHOLDER """, + ) + } + expect { + loggedEvent { + level = withLogLevel + message = "\"${withLogLevel.levelName} eventBuilder\"" + formattedMessage = "${withLogLevel.levelName} eventBuilder" + hasMarker = withMarker + hasThrowable = withThrowable + } + } + } + test { + code { + useClass = withClass + useThrowable = withThrowable + useMarker = withMarker + initCode = "val i = 42" + logStatement = + LogStatement( + funName = "at", + arguments = + listOf( + "Level.${withLogLevel.levelName.toUpperCaseAsciiOnly()}", + MARKER_PLACEHOLDER, + ), + lastArgumentLambda = + """ message="${withLogLevel.levelName} eventBuilder ${ + expression( + "i" + ) + }"; cause=$THROWABLE_PLACEHOLDER """, + ) + } + expect { + loggedEvent { + level = withLogLevel + message = "\"${withLogLevel.levelName} eventBuilder ${expression("i")}\"" + formattedMessage = "${withLogLevel.levelName} eventBuilder 42" + hasMarker = withMarker + hasThrowable = withThrowable + } + } + } + test { + code { + useClass = withClass + useThrowable = withThrowable + useMarker = withMarker + initCode = "val i = 42" + logStatement = + LogStatement( + funName = "at", + arguments = + listOf( + "Level.${withLogLevel.levelName.toUpperCaseAsciiOnly()}", + MARKER_PLACEHOLDER, + ), + lastArgumentLambda = + """ message="${withLogLevel.levelName} eventBuilder ${ + expression( + "i" + ) + } ${expression("helper()")}"; cause=$THROWABLE_PLACEHOLDER """, + ) + extraMethodCode = """fun helper() = "Hello!"""" + } + expect { + loggedEvent { + level = withLogLevel + message = + "\"${withLogLevel.levelName} eventBuilder ${expression("i")} ${expression("helper()")}\"" + formattedMessage = "${withLogLevel.levelName} eventBuilder 42 Hello!" + hasMarker = withMarker + hasThrowable = withThrowable + } + } + } + } + } + } + } + } + } + } + } + } + + private fun expression(variableName: String) = + if (variableName.matches(Regex("[A-Za-z0-9_]*"))) "${'$'}$variableName" + else "${'$'}{$variableName}" + + @TestFactory + fun `generate code, compile it, run it and assert resulting log event(s)`(): List { + var testCounter = 0 + val preparedTests = testDefinitions.map { it.prepare(++testCounter) } + val featureFlagCompilationResults = compileTests(FeatureFlag.entries, preparedTests) + + File("code-samples-from-tests.md").bufferedWriter().use { writer -> + writer.write("# Code samples from tests\n\n") + writer.write(""" + |All the test cases that the plugin is tested against with before+after code snippets and how different feature + |flags affect the transformation. Organized on the top level by feature flags and then by groups of test cases. + |""".trimMargin()) + writer.write("\n") + featureFlagCompilationResults.forEach { featureFlagCompilationResult -> + featureFlagCompilationResult.compiledTests + .toMarkDownDocument("featureFlag=${featureFlagCompilationResult.featureFlag.name}") + .let { writer.write(it) } + } + } + + return featureFlagCompilationResults.map { + DynamicContainer.dynamicContainer( + "featureFlag=${it.featureFlag.name}", + it.compiledTests + .toDynamicTests { + DynamicTest.dynamicTest(preparedTest.testCode.testName) { + Assertions.assertAll(execute().assertResults()) + } + } + .children, + ) + } + } +} diff --git a/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/LogStatement.kt b/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/LogStatement.kt new file mode 100644 index 00000000..1d0929c9 --- /dev/null +++ b/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/LogStatement.kt @@ -0,0 +1,7 @@ +package io.github.oshai.kotlinlogging.irplugin + +data class LogStatement( + val funName: String, + val arguments: List = emptyList(), + val lastArgumentLambda: String? = null, +) diff --git a/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/PreparedTest.kt b/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/PreparedTest.kt new file mode 100644 index 00000000..fcaeb5a0 --- /dev/null +++ b/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/PreparedTest.kt @@ -0,0 +1,66 @@ +package io.github.oshai.kotlinlogging.irplugin + +import io.github.oshai.kotlinlogging.irplugin.PreparedTest.SourceCode + +data class PreparedTest( + val definition: TestDefinition, + val uniqueTestNumber: Int, + val testCode: PreparedTestCode, +) : TestLeaf by definition { + + data class SourceCode(val fileName: String, val text: String) + + fun compiled( + classLoader: ClassLoader, + expectationAdjusters: List Unit>, + ): CompiledTest { + return CompiledTest( + preparedTest = this, + classLoader = classLoader, + expectedExecutionResult = + adjustExpectations( + expectationAdjusters, + definition.toExpectedTestExecutionResult(makeExpectedStackTraceElement()), + ), + ) + } + + private fun adjustExpectations( + expectationAdjusters: List Unit>, + originalExpectedTestExecutionResult: TestExecutionResult, + ): TestExecutionResult { + val result = TestExecutionResultBuilder(originalExpectedTestExecutionResult) + for (adjuster in expectationAdjusters) { + adjuster.invoke(result) + } + return result.build() + } + + private fun makeExpectedStackTraceElement(): StackTraceElement { + return StackTraceElement( + testCode.fqClassName, + testCode.funName, + testCode.fileName, + testCode.logStatementLineNumber, + ) + } + + fun prepareTransformed(expectedExecutionResult: TestExecutionResult): PreparedTestCode? { + return definition.codeDescription.prepareTransformed(uniqueTestNumber, expectedExecutionResult) + } +} + +data class PreparedTestCode( + val testName: String, + val fileName: String, + val packageName: String, + val className: String, + val classDeclareStart: String, + val classDeclareEnd: String, + val fqClassName: String, + val funName: String, + val logStatementLineNumber: Int, + val needsInstance: Boolean, + val sourceCode: SourceCode, + val sourceCodeForDebugging: String = "", +) diff --git a/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/TestCollection.kt b/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/TestCollection.kt new file mode 100644 index 00000000..3333223d --- /dev/null +++ b/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/TestCollection.kt @@ -0,0 +1,103 @@ +package io.github.oshai.kotlinlogging.irplugin + +import org.junit.jupiter.api.DynamicContainer +import org.junit.jupiter.api.DynamicTest + +data class TestCollection( + val name: String, + private val childCollections: List>, + private val tests: List, + private var expectationAdjustersPerTest: List, +) { + + fun map(mapper: (T) -> TT): TestCollection { + return TestCollection( + name, + childCollections.map { it.map(mapper) }, + tests.map { mapper(it) }, + expectationAdjustersPerTest, + ) + } + + fun mapWithExpectationAdjusters( + featureFlag: FeatureFlag, + parentExpectationAdjusters: List Unit>, + mapper: (List Unit>, T) -> TT, + ): TestCollection { + val expectationAdjusters = + parentExpectationAdjusters + + expectationAdjustersPerTest + .filter { it.applicableFeatureFlags.contains(featureFlag) } + .map { it.expectationAdjuster } + return TestCollection( + name, + childCollections.map { + it.mapWithExpectationAdjusters(featureFlag, expectationAdjusters, mapper) + }, + tests.map { mapper(expectationAdjusters, it) }, + expectationAdjustersPerTest, + ) + } + + fun forEach( + indent: String = "", + collectionVisitor: (indent: String, TestCollection) -> Unit, + testVisitor: (indent: String, T) -> Unit, + ) { + collectionVisitor(indent, this) + tests.forEach { testVisitor(indent, it) } + childCollections.forEach { it.forEach(" $indent", collectionVisitor, testVisitor) } + } + + fun flatMapAndExtract(mapper: (T) -> M): List { + return childCollections.flatMap { it.flatMapAndExtract(mapper) } + tests.map(mapper) + } + + fun toDynamicTests(testMaker: T.() -> DynamicTest): DynamicContainer { + val children = + childCollections.map { it.toDynamicTests(testMaker) } + + tests.filter { !it.skip }.map { it.testMaker() } + return DynamicContainer.dynamicContainer(name, children) + } + + fun toMarkDownDocument(title: String): String { + val children = + childCollections.map { it.toMarkDownDocument(it.name) } + + tests.filter { !it.skip }.map { it.toMarkDownDocument() } + return "
$title\n\n${children.joinToString("\n\n")}\n\n
" + } +} + +interface TestLeaf { + val skip: Boolean + + fun toMarkDownDocument(): String { + TODO("Not implemented") + } +} + +fun rootCollection(init: TestCollectionBuilder.() -> Unit) = + TestCollectionBuilder().apply(init).build() + +class TestCollectionBuilder { + var name: String? = null + private var childCollections: MutableList> = mutableListOf() + private var tests: MutableList = mutableListOf() + private var expectationAdjustersPerTest: MutableList = + mutableListOf() + + fun collection(init: TestCollectionBuilder.() -> Unit) { + val element = TestCollectionBuilder().apply(init).build() + childCollections.add(element) + } + + fun test(init: TestDefinitionBuilder.() -> Unit) { + tests.add(TestDefinitionBuilder().apply(init).build()) + } + + fun featureFlagExpectationAdjuster(init: FeatureFlagExpectationAdjusterBuilder.() -> Unit) { + expectationAdjustersPerTest.add(FeatureFlagExpectationAdjusterBuilder().apply(init).build()) + } + + fun build() = TestCollection(name!!, childCollections, tests, expectationAdjustersPerTest) +} diff --git a/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/TestCompiler.kt b/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/TestCompiler.kt new file mode 100644 index 00000000..7b5b6767 --- /dev/null +++ b/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/TestCompiler.kt @@ -0,0 +1,67 @@ +package io.github.oshai.kotlinlogging.irplugin + +import com.tschuchort.compiletesting.JvmCompilationResult +import com.tschuchort.compiletesting.KotlinCompilation +import com.tschuchort.compiletesting.SourceFile +import kotlin.enums.EnumEntries +import kotlin.test.assertEquals +import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi + +@OptIn(ExperimentalCompilerApi::class) +fun compileTests( + featureFlagsToUse: EnumEntries, + preparedTests: TestCollection, +): List { + val sources = preparedTests.flatMapAndExtract { it.testCode.sourceCode } + return featureFlagsToUse.map { featureFlag -> + val result = + compile(sources.map { SourceFile.kotlin(it.fileName, it.text) }, featureFlag.configurer) + if (result.exitCode != KotlinCompilation.ExitCode.OK) { + preparedTests.forEach( + collectionVisitor = { indent, collection -> println(indent + collection.name) }, + testVisitor = { indent, test -> + println("${indent}Source file: ${test.testCode.fileName}") + println("${indent}Test definition: ${test.definition}") + println(indent + test.testCode.sourceCode.text) + println() + }, + ) + println(result.messages) + } + assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode) + FeatureFlagCompilationResult( + featureFlag = featureFlag, + compilationResult = result, + compiledTests = + preparedTests.mapWithExpectationAdjusters( + featureFlag, + listOf(featureFlag.expectationAdjuster), + ) { expectationAdjusters, preparedTest -> + preparedTest.compiled(result.classLoader, expectationAdjusters) + }, + ) + } +} + +@OptIn(ExperimentalCompilerApi::class) +private fun compile( + sourceFiles: List, + pluginConfigFactory: () -> KotlinLoggingIrPluginConfig, +): JvmCompilationResult { + return KotlinCompilation() + .apply { + sources = sourceFiles + compilerPluginRegistrars = + listOf(KotlinLoggingCompilerRegistrar(pluginConfigFactory.invoke())) + inheritClassPath = true + } + .compile() +} + +data class FeatureFlagCompilationResult +@OptIn(ExperimentalCompilerApi::class) +constructor( + val featureFlag: FeatureFlag, + val compilationResult: JvmCompilationResult, + val compiledTests: TestCollection, +) diff --git a/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/TestDefinition.kt b/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/TestDefinition.kt new file mode 100644 index 00000000..095b90c5 --- /dev/null +++ b/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/TestDefinition.kt @@ -0,0 +1,251 @@ +package io.github.oshai.kotlinlogging.irplugin + +import java.io.BufferedReader +import java.io.StringReader +import java.util.stream.Collectors +import kotlin.reflect.KClass +import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeAsciiOnly + +data class TestDefinition( + override val skip: Boolean, + val codeDescription: TestCodeDescription, + val expectedResult: TestExecutionResult, +) : TestLeaf { + + fun prepare(uniqueTestNumber: Int): PreparedTest { + return PreparedTest( + definition = this, + uniqueTestNumber = uniqueTestNumber, + testCode = codeDescription.prepare(uniqueTestNumber), + ) + } +} + +class TestDefinitionBuilder { + var skip: Boolean? = null + private var codeDescription: TestCodeDescription? = null + private var expectedResult: TestExecutionResult? = null + + fun code(init: TestCodeDescriptionBuilder.() -> Unit) { + codeDescription = TestCodeDescriptionBuilder().apply(init).build() + } + + fun expect(init: TestExecutionResultBuilder.() -> Unit) { + expectedResult = TestExecutionResultBuilder().apply(init).build() + } + + fun build(): TestDefinition { + return TestDefinition( + skip = skip ?: false, + codeDescription = codeDescription!!, + expectedResult = expectedResult!!, + ) + } +} + +data class TestCodeDescription( + val useClass: Boolean, + val useThrowable: Boolean, + val useMarker: Boolean, + val funName: String = "main", + val funReturnType: KClass<*>?, + val initCode: String, + val logStatement: LogStatement, + val throwReturnValueFromLogStatement: Boolean, + val extraMethodCode: String, +) { + fun prepare(uniqueTestNumber: Int) = + prepare(uniqueTestNumber) { logStatement.makeSource(useMarker, useThrowable) } + + fun prepareTransformed(uniqueTestNumber: Int, expectedResult: TestExecutionResult) = + if (expectedResult.loggedEvent != null) + prepare(uniqueTestNumber) { logStatement.makeTransformedSource(expectedResult) } + else null + + private fun prepare( + uniqueTestNumber: Int, + logStatementSourceCodeMaker: () -> String, + ): PreparedTestCode { + val fileName = "test${uniqueTestNumber}.kt" + val packageName = "test${uniqueTestNumber}" + val className: String + val classDeclareStart: String + val classDeclareEnd: String + val needsInstance: Boolean + val classIndent: String + if (useClass) { + className = "MainTest" + classDeclareStart = "public class $className {" + classDeclareEnd = "}" + needsInstance = true + classIndent = " " + } else { + className = fileName.capitalizeAsciiOnly().substringBefore(".kt") + "Kt" + classDeclareStart = "" + classDeclareEnd = "" + needsInstance = false + classIndent = "" + } + // line number depends on the generated source code template (see below) + val logStatementLineNumber = 10 + val fqClassName = "$packageName.$className" + val initMarkerSourceCode = + if (useMarker) "val $MARKER_VARIABLE_NAME = MyMarker(\"markerName\")" else "" + val declareMarkerSourceCode = + if (useMarker) + "class MyMarker(private val name: String): Marker { override fun getName() = name }" + else "" + val initThrowableSourceCode = + if (useThrowable) "val $THROWABLE_VARIABLE_NAME = Exception(\"$EXCEPTION_MESSAGE\")" else "" + val logStatementPrefix: String + val funReturnTypeSuffix: String + if (funReturnType != null) { + logStatementPrefix = "return " + funReturnTypeSuffix = ": " + funReturnType.qualifiedName?.removePrefix("kotlin.") + } else { + funReturnTypeSuffix = "" + if (throwReturnValueFromLogStatement) { + logStatementPrefix = "throw " + } else { + logStatementPrefix = "" + } + } + val logStatementSourceCode = logStatementSourceCodeMaker() + val fullSourceCode = + """ + package $packageName + import io.github.oshai.kotlinlogging.* + + $classDeclareStart + ${classIndent}fun ${funName}()$funReturnTypeSuffix { + ${classIndent} val logger = KotlinLogging.logger {} + ${classIndent} $initMarkerSourceCode + ${classIndent} $initThrowableSourceCode + ${classIndent} $initCode + ${classIndent} ${logStatementPrefix}logger.$logStatementSourceCode + ${classIndent}} + ${classIndent}$extraMethodCode + $classDeclareEnd + $declareMarkerSourceCode + """ + .trimIndent() + .trim() + return PreparedTestCode( + testName = + " $logStatementSourceCode at $className.${funName}($fileName:$logStatementLineNumber)", + fileName = fileName, + packageName = packageName, + className = className, + classDeclareStart = classDeclareStart, + classDeclareEnd = classDeclareEnd, + fqClassName = fqClassName, + funName = funName, + needsInstance = needsInstance, + logStatementLineNumber = logStatementLineNumber, + sourceCode = PreparedTest.SourceCode(fileName, fullSourceCode), + sourceCodeForDebugging = stringWithLineNumbers(fullSourceCode), + ) + } + + private fun stringWithLineNumbers(source: String): String { + val buffer = BufferedReader(StringReader(source)) + var lineNumber = 1 + return buffer.lines().map { line -> "${lineNumber++}: $line" }.collect(Collectors.joining("\n")) + } +} + +private fun LogStatement.makeSource(useMarker: Boolean, useThrowable: Boolean): String { + return "${funName}${makeArgumentList(useMarker, useThrowable)}${makeLastArgumentLambda(useThrowable)}" +} + +private fun LogStatement.makeTransformedSource(expectedResult: TestExecutionResult): String { + val loggedEvent: TestLoggingEvent = expectedResult.loggedEvent!! + val useMarker = loggedEvent.hasMarker + val useThrowable = loggedEvent.hasThrowable + val compilerDataValues = makeCompilerDataValues(loggedEvent) + if (compilerDataValues.isEmpty()) { + return makeSource(useMarker, useThrowable) + } + + if (funName in listOf("entry", "exit", "throwing", "catching")) { + val arguments = mutableListOf() + arguments.add( + "KLoggingEventBuilder.InternalCompilerData(${compilerDataValues.joinToString(", ")})" + ) + if (useThrowable) arguments.add(THROWABLE_VARIABLE_NAME) + return "${funName}WithCompilerData(${arguments.joinToString(", ")})" + } else { + val arguments = mutableListOf() + arguments.add("Level.${loggedEvent.level.name}") + if (useMarker) arguments.add(MARKER_VARIABLE_NAME) + + val lambdaValues = mutableListOf() + lambdaValues.add("message = \"${loggedEvent.formattedMessage}\"") + if (useThrowable) lambdaValues.add("cause = $THROWABLE_VARIABLE_NAME") + lambdaValues.add( + "internalCompilerData = KLoggingEventBuilder.InternalCompilerData(${compilerDataValues.joinToString(", ")})" + ) + + return "at(${arguments.joinToString(", ")}) { ${lambdaValues.joinToString("; ")}" + } +} + +private fun makeCompilerDataValues(loggedEvent: TestLoggingEvent): MutableList { + val compilerDataValues = mutableListOf() + if (loggedEvent.message != loggedEvent.formattedMessage) { + compilerDataValues.add("messageTemplate = \"${loggedEvent.message}\"") + } + val callerDataFirstElement = loggedEvent.callerDataFirstElement + if (callerDataFirstElement != null) { + compilerDataValues.add("className = \"${callerDataFirstElement.className}\"") + compilerDataValues.add("methodName = \"${callerDataFirstElement.methodName}\"") + compilerDataValues.add("fileName = \"${callerDataFirstElement.fileName}\"") + compilerDataValues.add("lineNumber = ${callerDataFirstElement.lineNumber}") + } + return compilerDataValues +} + +private fun LogStatement.makeArgumentList(useMarker: Boolean, useThrowable: Boolean): String { + val arguments = + arguments + .map { + when (it) { + MARKER_PLACEHOLDER -> if (useMarker) MARKER_VARIABLE_NAME else "" + THROWABLE_PLACEHOLDER -> if (useThrowable) THROWABLE_VARIABLE_NAME else "" + else -> it + } + } + .filter { it.isNotEmpty() } + return "(${arguments.joinToString(", ")})" +} + +private fun LogStatement.makeLastArgumentLambda(useThrowable: Boolean): String { + val throwableValue = if (useThrowable) THROWABLE_VARIABLE_NAME else "null" + return if (lastArgumentLambda != null) + " {${lastArgumentLambda.replace(THROWABLE_PLACEHOLDER, throwableValue)}}" + else "" +} + +class TestCodeDescriptionBuilder { + var useClass: Boolean? = null + var useThrowable: Boolean? = null + var useMarker: Boolean? = null + var initCode: String = "" + var funReturnType: KClass<*>? = null + var logStatement: LogStatement? = null + var throwReturnValueFromLogStatement: Boolean? = null + var extraMethodCode: String = "" + + fun build(): TestCodeDescription { + return TestCodeDescription( + useClass = useClass ?: false, + useThrowable = useThrowable ?: false, + useMarker = useMarker ?: false, + initCode = initCode, + funReturnType = funReturnType, + logStatement = logStatement!!, + throwReturnValueFromLogStatement = throwReturnValueFromLogStatement ?: false, + extraMethodCode = extraMethodCode, + ) + } +} diff --git a/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/TestExecutionResult.kt b/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/TestExecutionResult.kt new file mode 100644 index 00000000..f1153670 --- /dev/null +++ b/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/TestExecutionResult.kt @@ -0,0 +1,64 @@ +package io.github.oshai.kotlinlogging.irplugin + +data class TestExecutionResult( + val returnedValue: Any? = null, + val thrownExceptionToString: String? = null, + val loggedEvent: TestLoggingEvent? = null, +) + +class TestExecutionResultBuilder(sourceTestExecutionResult: TestExecutionResult? = null) { + var returnedValue: Any? = sourceTestExecutionResult?.returnedValue + var thrownExceptionToString: String? = sourceTestExecutionResult?.thrownExceptionToString + private var loggedEvent: TestLoggingEvent? = sourceTestExecutionResult?.loggedEvent + + fun loggedEvent(block: (TestLoggingEventBuilder.() -> Unit)?) { + loggedEvent = + if (block != null) TestLoggingEventBuilder(loggedEvent).apply(block).build() else null + } + + fun build(): TestExecutionResult { + return TestExecutionResult( + returnedValue = returnedValue, + thrownExceptionToString = thrownExceptionToString, + loggedEvent = loggedEvent, + ) + } +} + +fun TestDefinition.toExpectedTestExecutionResult( + expectedStackTraceElement: StackTraceElement? +): TestExecutionResult { + return expectedResult.copy( + loggedEvent = + expectedResult.loggedEvent?.copy(callerDataFirstElement = expectedStackTraceElement) + ) +} + +data class TestLoggingEvent( + val level: TestLoggingLevel, + val message: String, + val formattedMessage: String, + val hasMarker: Boolean, + val hasThrowable: Boolean, + val callerDataFirstElement: StackTraceElement?, +) + +class TestLoggingEventBuilder(sourceEvent: TestLoggingEvent? = null) { + var level: TestLoggingLevel? = sourceEvent?.level + var message: String? = sourceEvent?.message + var formattedMessage: String? = sourceEvent?.formattedMessage + var hasMarker: Boolean? = sourceEvent?.hasMarker + var hasThrowable: Boolean? = sourceEvent?.hasThrowable + var callerDataFirstElement: StackTraceElement? = sourceEvent?.callerDataFirstElement + + fun build(): TestLoggingEvent { + return TestLoggingEvent( + level = level!!, + message = message!!, + formattedMessage = formattedMessage!!, + hasMarker = hasMarker!!, + hasThrowable = hasThrowable!!, + callerDataFirstElement = callerDataFirstElement, + ) + } +} diff --git a/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/TestLoggingLevel.kt b/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/TestLoggingLevel.kt new file mode 100644 index 00000000..f45d61ec --- /dev/null +++ b/kotlin-ir-plugin/src/test/kotlin/io/github/oshai/kotlinlogging/irplugin/TestLoggingLevel.kt @@ -0,0 +1,11 @@ +package io.github.oshai.kotlinlogging.irplugin + +import ch.qos.logback.classic.Level + +enum class TestLoggingLevel(val levelEnum: Level, val levelName: String) { + TRACE(Level.TRACE, "trace"), + DEBUG(Level.DEBUG, "debug"), + INFO(Level.INFO, "info"), + WARN(Level.WARN, "warn"), + ERROR(Level.ERROR, "error") +} diff --git a/kotlin-ir-plugin/src/test/resources/logback.xml b/kotlin-ir-plugin/src/test/resources/logback.xml new file mode 100644 index 00000000..a8ffcf57 --- /dev/null +++ b/kotlin-ir-plugin/src/test/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{yyyy-MM-dd HH:mm:ss} %-5level %logger{36} - %msg%n + + + + + + + + diff --git a/kotlin-ir-plugin/tests.md b/kotlin-ir-plugin/tests.md new file mode 100644 index 00000000..d8a33936 --- /dev/null +++ b/kotlin-ir-plugin/tests.md @@ -0,0 +1,146485 @@ +# Samples from tests + +
featureFlag=DEFAULT + +
with class=true + +
entry/exit API + +### entry(argument1, argument2) at MainTest.main(test1.kt:10) test + +User code: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) + } + +} +``` + +Transformed into: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entryWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "entry(argument1, argument2)", className = "test1.MainTest", methodName = "main", fileName = "test1.kt", lineNumber = 10)) + } + +} +``` + +### exit(resultValue) at MainTest.main(test2.kt:10) test + +User code: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) + } + +} +``` + +Transformed into: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "exit(resultValue)", className = "test2.MainTest", methodName = "main", fileName = "test2.kt", lineNumber = 10)) + } + +} +``` + +### exit() at MainTest.main(test3.kt:10) test + +User code: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() + } + +} +``` + +Transformed into: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(className = "test3.MainTest", methodName = "main", fileName = "test3.kt", lineNumber = 10)) + } + +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at MainTest.main(test4.kt:10) test + +User code: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) + } + +} +``` + +Transformed into: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "throwing(throwable)", className = "test4.MainTest", methodName = "main", fileName = "test4.kt", lineNumber = 10), throwable) + } + +} +``` + +### catching(throwable) at MainTest.main(test5.kt:10) test + +User code: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) + } + +} +``` + +Transformed into: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catchingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "catching(throwable)", className = "test5.MainTest", methodName = "main", fileName = "test5.kt", lineNumber = 10), throwable) + } + +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at MainTest.main(test6.kt:10) test + +User code: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test6.MainTest", methodName = "main", fileName = "test6.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test7.kt:10) test + +User code: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test7.MainTest", methodName = "main", fileName = "test7.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test8.kt:10) test + +User code: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test8.MainTest", methodName = "main", fileName = "test8.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at MainTest.main(test9.kt:10) test + +User code: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test9.MainTest", methodName = "main", fileName = "test9.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at MainTest.main(test10.kt:10) test + +User code: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test10.MainTest", methodName = "main", fileName = "test10.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test11.kt:10) test + +User code: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test11.MainTest", methodName = "main", fileName = "test11.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at MainTest.main(test12.kt:10) test + +User code: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test12.MainTest", methodName = "main", fileName = "test12.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at MainTest.main(test13.kt:10) test + +User code: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test13.MainTest", methodName = "main", fileName = "test13.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at MainTest.main(test14.kt:10) test + +User code: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test14.MainTest", methodName = "main", fileName = "test14.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test15.kt:10) test + +User code: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test15.MainTest", methodName = "main", fileName = "test15.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test16.kt:10) test + +User code: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test16.MainTest", methodName = "main", fileName = "test16.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test17.kt:10) test + +User code: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test17.MainTest", methodName = "main", fileName = "test17.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test18.kt:10) test + +User code: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test18.MainTest", methodName = "main", fileName = "test18.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test19.kt:10) test + +User code: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test19.MainTest", methodName = "main", fileName = "test19.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test20.kt:10) test + +User code: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test20.MainTest", methodName = "main", fileName = "test20.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test21.kt:10) test + +User code: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test21.MainTest", methodName = "main", fileName = "test21.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at MainTest.main(test22.kt:10) test + +User code: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test22.MainTest", methodName = "main", fileName = "test22.kt", lineNumber = 10) + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test23.kt:10) test + +User code: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test23.MainTest", methodName = "main", fileName = "test23.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test24.kt:10) test + +User code: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test24.MainTest", methodName = "main", fileName = "test24.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}", throwable) at MainTest.main(test28.kt:10) test + +User code: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test28.MainTest", methodName = "main", fileName = "test28.kt", lineNumber = 10) + } + +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at MainTest.main(test29.kt:10) test + +User code: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test29.MainTest", methodName = "main", fileName = "test29.kt", lineNumber = 10) + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at MainTest.main(test30.kt:10) test + +User code: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test30.MainTest", methodName = "main", fileName = "test30.kt", lineNumber = 10) + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test31.kt:10) test + +User code: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test31.MainTest", methodName = "main", fileName = "test31.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at MainTest.main(test32.kt:10) test + +User code: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test32.MainTest", methodName = "main", fileName = "test32.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test33.kt:10) test + +User code: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test33.MainTest", methodName = "main", fileName = "test33.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test34.kt:10) test + +User code: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test34.MainTest", methodName = "main", fileName = "test34.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test35.kt:10) test + +User code: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test35.MainTest", methodName = "main", fileName = "test35.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test36.kt:10) test + +User code: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test36.MainTest", methodName = "main", fileName = "test36.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test37.kt:10) test + +User code: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test37.MainTest", methodName = "main", fileName = "test37.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at MainTest.main(test38.kt:10) test + +User code: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test38.MainTest", methodName = "main", fileName = "test38.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test39.kt:10) test + +User code: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test39.MainTest", methodName = "main", fileName = "test39.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test40.kt:10) test + +User code: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test40.MainTest", methodName = "main", fileName = "test40.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at MainTest.main(test41.kt:10) test + +User code: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test41.MainTest", methodName = "main", fileName = "test41.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at MainTest.main(test42.kt:10) test + +User code: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test42.MainTest", methodName = "main", fileName = "test42.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test43.kt:10) test + +User code: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test43.MainTest", methodName = "main", fileName = "test43.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at MainTest.main(test44.kt:10) test + +User code: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test44.MainTest", methodName = "main", fileName = "test44.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test48.kt:10) test + +User code: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test48.MainTest", methodName = "main", fileName = "test48.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test49.kt:10) test + +User code: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test49.MainTest", methodName = "main", fileName = "test49.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test50.kt:10) test + +User code: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test50.MainTest", methodName = "main", fileName = "test50.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test51.kt:10) test + +User code: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test51.MainTest", methodName = "main", fileName = "test51.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test52.kt:10) test + +User code: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test52.MainTest", methodName = "main", fileName = "test52.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test53.kt:10) test + +User code: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test53.MainTest", methodName = "main", fileName = "test53.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at MainTest.main(test54.kt:10) test + +User code: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test54.MainTest", methodName = "main", fileName = "test54.kt", lineNumber = 10) + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test55.kt:10) test + +User code: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test55.MainTest", methodName = "main", fileName = "test55.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test56.kt:10) test + +User code: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test56.MainTest", methodName = "main", fileName = "test56.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}") at MainTest.main(test60.kt:10) test + +User code: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") + } + +} +``` + +Transformed into: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test60.MainTest", methodName = "main", fileName = "test60.kt", lineNumber = 10) + } + +} +``` + +
+ +### trace() { "trace messageBuilder" } at MainTest.main(test61.kt:10) test + +User code: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test61.MainTest", methodName = "main", fileName = "test61.kt", lineNumber = 10) + } + +} +``` + +### trace() { "trace messageBuilder $i" } at MainTest.main(test62.kt:10) test + +User code: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test62.MainTest", methodName = "main", fileName = "test62.kt", lineNumber = 10) + } + +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at MainTest.main(test63.kt:10) test + +User code: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test63.MainTest", methodName = "main", fileName = "test63.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at MainTest.main(test64.kt:10) test + +User code: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test64.MainTest", methodName = "main", fileName = "test64.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at MainTest.main(test65.kt:10) test + +User code: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test65.MainTest", methodName = "main", fileName = "test65.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test66.kt:10) test + +User code: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test66.MainTest", methodName = "main", fileName = "test66.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at MainTest.main(test67.kt:10) test + +User code: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test67.MainTest", methodName = "main", fileName = "test67.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test68.kt:10) test + +User code: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test68.MainTest", methodName = "main", fileName = "test68.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test69.kt:10) test + +User code: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test69.MainTest", methodName = "main", fileName = "test69.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at MainTest.main(test70.kt:10) test + +User code: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test70.MainTest", methodName = "main", fileName = "test70.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test71.kt:10) test + +User code: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test71.MainTest", methodName = "main", fileName = "test71.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test72.kt:10) test + +User code: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test72.MainTest", methodName = "main", fileName = "test72.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at MainTest.main(test73.kt:10) test + +User code: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test73.MainTest", methodName = "main", fileName = "test73.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at MainTest.main(test74.kt:10) test + +User code: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test74.MainTest", methodName = "main", fileName = "test74.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test75.kt:10) test + +User code: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test75.MainTest", methodName = "main", fileName = "test75.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at MainTest.main(test76.kt:10) test + +User code: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test76.MainTest", methodName = "main", fileName = "test76.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at MainTest.main(test77.kt:10) test + +User code: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test77.MainTest", methodName = "main", fileName = "test77.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at MainTest.main(test78.kt:10) test + +User code: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test78.MainTest", methodName = "main", fileName = "test78.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test79.kt:10) test + +User code: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test79.MainTest", methodName = "main", fileName = "test79.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test80.kt:10) test + +User code: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test80.MainTest", methodName = "main", fileName = "test80.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test81.kt:10) test + +User code: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test81.MainTest", methodName = "main", fileName = "test81.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test82.kt:10) test + +User code: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test82.MainTest", methodName = "main", fileName = "test82.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test83.kt:10) test + +User code: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test83.MainTest", methodName = "main", fileName = "test83.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test84.kt:10) test + +User code: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test84.MainTest", methodName = "main", fileName = "test84.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test85.kt:10) test + +User code: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test85.MainTest", methodName = "main", fileName = "test85.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at MainTest.main(test86.kt:10) test + +User code: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test86.MainTest", methodName = "main", fileName = "test86.kt", lineNumber = 10) + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test87.kt:10) test + +User code: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test87.MainTest", methodName = "main", fileName = "test87.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test88.kt:10) test + +User code: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test88.MainTest", methodName = "main", fileName = "test88.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}", throwable) at MainTest.main(test92.kt:10) test + +User code: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test92.MainTest", methodName = "main", fileName = "test92.kt", lineNumber = 10) + } + +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at MainTest.main(test93.kt:10) test + +User code: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test93.MainTest", methodName = "main", fileName = "test93.kt", lineNumber = 10) + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at MainTest.main(test94.kt:10) test + +User code: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test94.MainTest", methodName = "main", fileName = "test94.kt", lineNumber = 10) + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test95.kt:10) test + +User code: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test95.MainTest", methodName = "main", fileName = "test95.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at MainTest.main(test96.kt:10) test + +User code: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test96.MainTest", methodName = "main", fileName = "test96.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test97.kt:10) test + +User code: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test97.MainTest", methodName = "main", fileName = "test97.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test98.kt:10) test + +User code: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test98.MainTest", methodName = "main", fileName = "test98.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test99.kt:10) test + +User code: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test99.MainTest", methodName = "main", fileName = "test99.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test100.kt:10) test + +User code: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test100.MainTest", methodName = "main", fileName = "test100.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test101.kt:10) test + +User code: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test101.MainTest", methodName = "main", fileName = "test101.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at MainTest.main(test102.kt:10) test + +User code: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test102.MainTest", methodName = "main", fileName = "test102.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test103.kt:10) test + +User code: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test103.MainTest", methodName = "main", fileName = "test103.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test104.kt:10) test + +User code: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test104.MainTest", methodName = "main", fileName = "test104.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at MainTest.main(test105.kt:10) test + +User code: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test105.MainTest", methodName = "main", fileName = "test105.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at MainTest.main(test106.kt:10) test + +User code: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test106.MainTest", methodName = "main", fileName = "test106.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test107.kt:10) test + +User code: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test107.MainTest", methodName = "main", fileName = "test107.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at MainTest.main(test108.kt:10) test + +User code: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test108.MainTest", methodName = "main", fileName = "test108.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test112.kt:10) test + +User code: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test112.MainTest", methodName = "main", fileName = "test112.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test113.kt:10) test + +User code: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test113.MainTest", methodName = "main", fileName = "test113.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test114.kt:10) test + +User code: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test114.MainTest", methodName = "main", fileName = "test114.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test115.kt:10) test + +User code: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test115.MainTest", methodName = "main", fileName = "test115.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test116.kt:10) test + +User code: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test116.MainTest", methodName = "main", fileName = "test116.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test117.kt:10) test + +User code: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test117.MainTest", methodName = "main", fileName = "test117.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at MainTest.main(test118.kt:10) test + +User code: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test118.MainTest", methodName = "main", fileName = "test118.kt", lineNumber = 10) + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test119.kt:10) test + +User code: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test119.MainTest", methodName = "main", fileName = "test119.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test120.kt:10) test + +User code: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test120.MainTest", methodName = "main", fileName = "test120.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}") at MainTest.main(test124.kt:10) test + +User code: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") + } + +} +``` + +Transformed into: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test124.MainTest", methodName = "main", fileName = "test124.kt", lineNumber = 10) + } + +} +``` + +
+ +### debug() { "debug messageBuilder" } at MainTest.main(test125.kt:10) test + +User code: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test125.MainTest", methodName = "main", fileName = "test125.kt", lineNumber = 10) + } + +} +``` + +### debug() { "debug messageBuilder $i" } at MainTest.main(test126.kt:10) test + +User code: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test126.MainTest", methodName = "main", fileName = "test126.kt", lineNumber = 10) + } + +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at MainTest.main(test127.kt:10) test + +User code: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test127.MainTest", methodName = "main", fileName = "test127.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at MainTest.main(test128.kt:10) test + +User code: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test128.MainTest", methodName = "main", fileName = "test128.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at MainTest.main(test129.kt:10) test + +User code: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test129.MainTest", methodName = "main", fileName = "test129.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test130.kt:10) test + +User code: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test130.MainTest", methodName = "main", fileName = "test130.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at MainTest.main(test131.kt:10) test + +User code: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test131.MainTest", methodName = "main", fileName = "test131.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test132.kt:10) test + +User code: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test132.MainTest", methodName = "main", fileName = "test132.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test133.kt:10) test + +User code: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test133.MainTest", methodName = "main", fileName = "test133.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at MainTest.main(test134.kt:10) test + +User code: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test134.MainTest", methodName = "main", fileName = "test134.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test135.kt:10) test + +User code: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test135.MainTest", methodName = "main", fileName = "test135.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test136.kt:10) test + +User code: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test136.MainTest", methodName = "main", fileName = "test136.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at MainTest.main(test137.kt:10) test + +User code: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test137.MainTest", methodName = "main", fileName = "test137.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at MainTest.main(test138.kt:10) test + +User code: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test138.MainTest", methodName = "main", fileName = "test138.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test139.kt:10) test + +User code: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test139.MainTest", methodName = "main", fileName = "test139.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at MainTest.main(test140.kt:10) test + +User code: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test140.MainTest", methodName = "main", fileName = "test140.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at MainTest.main(test141.kt:10) test + +User code: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test141.MainTest", methodName = "main", fileName = "test141.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at MainTest.main(test142.kt:10) test + +User code: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test142.MainTest", methodName = "main", fileName = "test142.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test143.kt:10) test + +User code: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test143.MainTest", methodName = "main", fileName = "test143.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test144.kt:10) test + +User code: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test144.MainTest", methodName = "main", fileName = "test144.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test145.kt:10) test + +User code: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test145.MainTest", methodName = "main", fileName = "test145.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test146.kt:10) test + +User code: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test146.MainTest", methodName = "main", fileName = "test146.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test147.kt:10) test + +User code: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test147.MainTest", methodName = "main", fileName = "test147.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test148.kt:10) test + +User code: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test148.MainTest", methodName = "main", fileName = "test148.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test149.kt:10) test + +User code: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test149.MainTest", methodName = "main", fileName = "test149.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at MainTest.main(test150.kt:10) test + +User code: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test150.MainTest", methodName = "main", fileName = "test150.kt", lineNumber = 10) + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test151.kt:10) test + +User code: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test151.MainTest", methodName = "main", fileName = "test151.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test152.kt:10) test + +User code: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test152.MainTest", methodName = "main", fileName = "test152.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}", throwable) at MainTest.main(test156.kt:10) test + +User code: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test156.MainTest", methodName = "main", fileName = "test156.kt", lineNumber = 10) + } + +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at MainTest.main(test157.kt:10) test + +User code: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test157.MainTest", methodName = "main", fileName = "test157.kt", lineNumber = 10) + } + +} +``` + +### info(throwable) { "info messageBuilder $i" } at MainTest.main(test158.kt:10) test + +User code: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test158.MainTest", methodName = "main", fileName = "test158.kt", lineNumber = 10) + } + +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test159.kt:10) test + +User code: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test159.MainTest", methodName = "main", fileName = "test159.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at MainTest.main(test160.kt:10) test + +User code: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test160.MainTest", methodName = "main", fileName = "test160.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test161.kt:10) test + +User code: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test161.MainTest", methodName = "main", fileName = "test161.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test162.kt:10) test + +User code: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test162.MainTest", methodName = "main", fileName = "test162.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at MainTest.main(test163.kt:10) test + +User code: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test163.MainTest", methodName = "main", fileName = "test163.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test164.kt:10) test + +User code: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test164.MainTest", methodName = "main", fileName = "test164.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test165.kt:10) test + +User code: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test165.MainTest", methodName = "main", fileName = "test165.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at MainTest.main(test166.kt:10) test + +User code: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test166.MainTest", methodName = "main", fileName = "test166.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test167.kt:10) test + +User code: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test167.MainTest", methodName = "main", fileName = "test167.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test168.kt:10) test + +User code: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test168.MainTest", methodName = "main", fileName = "test168.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at MainTest.main(test169.kt:10) test + +User code: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test169.MainTest", methodName = "main", fileName = "test169.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at MainTest.main(test170.kt:10) test + +User code: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test170.MainTest", methodName = "main", fileName = "test170.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test171.kt:10) test + +User code: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test171.MainTest", methodName = "main", fileName = "test171.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at MainTest.main(test172.kt:10) test + +User code: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test172.MainTest", methodName = "main", fileName = "test172.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at MainTest.main(test176.kt:10) test + +User code: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test176.MainTest", methodName = "main", fileName = "test176.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test177.kt:10) test + +User code: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test177.MainTest", methodName = "main", fileName = "test177.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test178.kt:10) test + +User code: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test178.MainTest", methodName = "main", fileName = "test178.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at MainTest.main(test179.kt:10) test + +User code: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test179.MainTest", methodName = "main", fileName = "test179.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test180.kt:10) test + +User code: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test180.MainTest", methodName = "main", fileName = "test180.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test181.kt:10) test + +User code: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test181.MainTest", methodName = "main", fileName = "test181.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at MainTest.main(test182.kt:10) test + +User code: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test182.MainTest", methodName = "main", fileName = "test182.kt", lineNumber = 10) + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test183.kt:10) test + +User code: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test183.MainTest", methodName = "main", fileName = "test183.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test184.kt:10) test + +User code: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test184.MainTest", methodName = "main", fileName = "test184.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}") at MainTest.main(test188.kt:10) test + +User code: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") + } + +} +``` + +Transformed into: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test188.MainTest", methodName = "main", fileName = "test188.kt", lineNumber = 10) + } + +} +``` + +
+ +### info() { "info messageBuilder" } at MainTest.main(test189.kt:10) test + +User code: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test189.MainTest", methodName = "main", fileName = "test189.kt", lineNumber = 10) + } + +} +``` + +### info() { "info messageBuilder $i" } at MainTest.main(test190.kt:10) test + +User code: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test190.MainTest", methodName = "main", fileName = "test190.kt", lineNumber = 10) + } + +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at MainTest.main(test191.kt:10) test + +User code: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test191.MainTest", methodName = "main", fileName = "test191.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=null } at MainTest.main(test192.kt:10) test + +User code: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test192.MainTest", methodName = "main", fileName = "test192.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at MainTest.main(test193.kt:10) test + +User code: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test193.MainTest", methodName = "main", fileName = "test193.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test194.kt:10) test + +User code: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test194.MainTest", methodName = "main", fileName = "test194.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at MainTest.main(test195.kt:10) test + +User code: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test195.MainTest", methodName = "main", fileName = "test195.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at MainTest.main(test196.kt:10) test + +User code: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test196.MainTest", methodName = "main", fileName = "test196.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test197.kt:10) test + +User code: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test197.MainTest", methodName = "main", fileName = "test197.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at MainTest.main(test198.kt:10) test + +User code: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test198.MainTest", methodName = "main", fileName = "test198.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test199.kt:10) test + +User code: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test199.MainTest", methodName = "main", fileName = "test199.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test200.kt:10) test + +User code: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test200.MainTest", methodName = "main", fileName = "test200.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at MainTest.main(test201.kt:10) test + +User code: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test201.MainTest", methodName = "main", fileName = "test201.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at MainTest.main(test202.kt:10) test + +User code: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test202.MainTest", methodName = "main", fileName = "test202.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test203.kt:10) test + +User code: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test203.MainTest", methodName = "main", fileName = "test203.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at MainTest.main(test204.kt:10) test + +User code: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test204.MainTest", methodName = "main", fileName = "test204.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at MainTest.main(test205.kt:10) test + +User code: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test205.MainTest", methodName = "main", fileName = "test205.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at MainTest.main(test206.kt:10) test + +User code: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test206.MainTest", methodName = "main", fileName = "test206.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test207.kt:10) test + +User code: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test207.MainTest", methodName = "main", fileName = "test207.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test208.kt:10) test + +User code: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test208.MainTest", methodName = "main", fileName = "test208.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test209.kt:10) test + +User code: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test209.MainTest", methodName = "main", fileName = "test209.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test210.kt:10) test + +User code: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test210.MainTest", methodName = "main", fileName = "test210.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test211.kt:10) test + +User code: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test211.MainTest", methodName = "main", fileName = "test211.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test212.kt:10) test + +User code: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test212.MainTest", methodName = "main", fileName = "test212.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test213.kt:10) test + +User code: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test213.MainTest", methodName = "main", fileName = "test213.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at MainTest.main(test214.kt:10) test + +User code: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test214.MainTest", methodName = "main", fileName = "test214.kt", lineNumber = 10) + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test215.kt:10) test + +User code: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test215.MainTest", methodName = "main", fileName = "test215.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test216.kt:10) test + +User code: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test216.MainTest", methodName = "main", fileName = "test216.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}", throwable) at MainTest.main(test220.kt:10) test + +User code: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test220.MainTest", methodName = "main", fileName = "test220.kt", lineNumber = 10) + } + +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at MainTest.main(test221.kt:10) test + +User code: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test221.MainTest", methodName = "main", fileName = "test221.kt", lineNumber = 10) + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at MainTest.main(test222.kt:10) test + +User code: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test222.MainTest", methodName = "main", fileName = "test222.kt", lineNumber = 10) + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test223.kt:10) test + +User code: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test223.MainTest", methodName = "main", fileName = "test223.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at MainTest.main(test224.kt:10) test + +User code: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test224.MainTest", methodName = "main", fileName = "test224.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test225.kt:10) test + +User code: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test225.MainTest", methodName = "main", fileName = "test225.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test226.kt:10) test + +User code: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test226.MainTest", methodName = "main", fileName = "test226.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test227.kt:10) test + +User code: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test227.MainTest", methodName = "main", fileName = "test227.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test228.kt:10) test + +User code: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test228.MainTest", methodName = "main", fileName = "test228.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test229.kt:10) test + +User code: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test229.MainTest", methodName = "main", fileName = "test229.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at MainTest.main(test230.kt:10) test + +User code: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test230.MainTest", methodName = "main", fileName = "test230.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test231.kt:10) test + +User code: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test231.MainTest", methodName = "main", fileName = "test231.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test232.kt:10) test + +User code: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test232.MainTest", methodName = "main", fileName = "test232.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at MainTest.main(test233.kt:10) test + +User code: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test233.MainTest", methodName = "main", fileName = "test233.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at MainTest.main(test234.kt:10) test + +User code: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test234.MainTest", methodName = "main", fileName = "test234.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test235.kt:10) test + +User code: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test235.MainTest", methodName = "main", fileName = "test235.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at MainTest.main(test236.kt:10) test + +User code: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test236.MainTest", methodName = "main", fileName = "test236.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test240.kt:10) test + +User code: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test240.MainTest", methodName = "main", fileName = "test240.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test241.kt:10) test + +User code: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test241.MainTest", methodName = "main", fileName = "test241.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test242.kt:10) test + +User code: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test242.MainTest", methodName = "main", fileName = "test242.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test243.kt:10) test + +User code: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test243.MainTest", methodName = "main", fileName = "test243.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test244.kt:10) test + +User code: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test244.MainTest", methodName = "main", fileName = "test244.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test245.kt:10) test + +User code: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test245.MainTest", methodName = "main", fileName = "test245.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at MainTest.main(test246.kt:10) test + +User code: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test246.MainTest", methodName = "main", fileName = "test246.kt", lineNumber = 10) + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test247.kt:10) test + +User code: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test247.MainTest", methodName = "main", fileName = "test247.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test248.kt:10) test + +User code: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test248.MainTest", methodName = "main", fileName = "test248.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}") at MainTest.main(test252.kt:10) test + +User code: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") + } + +} +``` + +Transformed into: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test252.MainTest", methodName = "main", fileName = "test252.kt", lineNumber = 10) + } + +} +``` + +
+ +### warn() { "warn messageBuilder" } at MainTest.main(test253.kt:10) test + +User code: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test253.MainTest", methodName = "main", fileName = "test253.kt", lineNumber = 10) + } + +} +``` + +### warn() { "warn messageBuilder $i" } at MainTest.main(test254.kt:10) test + +User code: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test254.MainTest", methodName = "main", fileName = "test254.kt", lineNumber = 10) + } + +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at MainTest.main(test255.kt:10) test + +User code: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test255.MainTest", methodName = "main", fileName = "test255.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at MainTest.main(test256.kt:10) test + +User code: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test256.MainTest", methodName = "main", fileName = "test256.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at MainTest.main(test257.kt:10) test + +User code: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test257.MainTest", methodName = "main", fileName = "test257.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test258.kt:10) test + +User code: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test258.MainTest", methodName = "main", fileName = "test258.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at MainTest.main(test259.kt:10) test + +User code: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test259.MainTest", methodName = "main", fileName = "test259.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test260.kt:10) test + +User code: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test260.MainTest", methodName = "main", fileName = "test260.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test261.kt:10) test + +User code: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test261.MainTest", methodName = "main", fileName = "test261.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at MainTest.main(test262.kt:10) test + +User code: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test262.MainTest", methodName = "main", fileName = "test262.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test263.kt:10) test + +User code: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test263.MainTest", methodName = "main", fileName = "test263.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test264.kt:10) test + +User code: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test264.MainTest", methodName = "main", fileName = "test264.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at MainTest.main(test265.kt:10) test + +User code: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test265.MainTest", methodName = "main", fileName = "test265.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at MainTest.main(test266.kt:10) test + +User code: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test266.MainTest", methodName = "main", fileName = "test266.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test267.kt:10) test + +User code: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test267.MainTest", methodName = "main", fileName = "test267.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at MainTest.main(test268.kt:10) test + +User code: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test268.MainTest", methodName = "main", fileName = "test268.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at MainTest.main(test269.kt:10) test + +User code: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test269.MainTest", methodName = "main", fileName = "test269.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at MainTest.main(test270.kt:10) test + +User code: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test270.MainTest", methodName = "main", fileName = "test270.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test271.kt:10) test + +User code: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test271.MainTest", methodName = "main", fileName = "test271.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test272.kt:10) test + +User code: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test272.MainTest", methodName = "main", fileName = "test272.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test273.kt:10) test + +User code: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test273.MainTest", methodName = "main", fileName = "test273.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test274.kt:10) test + +User code: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test274.MainTest", methodName = "main", fileName = "test274.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test275.kt:10) test + +User code: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test275.MainTest", methodName = "main", fileName = "test275.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test276.kt:10) test + +User code: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test276.MainTest", methodName = "main", fileName = "test276.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test277.kt:10) test + +User code: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test277.MainTest", methodName = "main", fileName = "test277.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at MainTest.main(test278.kt:10) test + +User code: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test278.MainTest", methodName = "main", fileName = "test278.kt", lineNumber = 10) + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test279.kt:10) test + +User code: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test279.MainTest", methodName = "main", fileName = "test279.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test280.kt:10) test + +User code: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test280.MainTest", methodName = "main", fileName = "test280.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}", throwable) at MainTest.main(test284.kt:10) test + +User code: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test284.MainTest", methodName = "main", fileName = "test284.kt", lineNumber = 10) + } + +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at MainTest.main(test285.kt:10) test + +User code: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test285.MainTest", methodName = "main", fileName = "test285.kt", lineNumber = 10) + } + +} +``` + +### error(throwable) { "error messageBuilder $i" } at MainTest.main(test286.kt:10) test + +User code: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test286.MainTest", methodName = "main", fileName = "test286.kt", lineNumber = 10) + } + +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test287.kt:10) test + +User code: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test287.MainTest", methodName = "main", fileName = "test287.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=throwable } at MainTest.main(test288.kt:10) test + +User code: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test288.MainTest", methodName = "main", fileName = "test288.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test289.kt:10) test + +User code: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test289.MainTest", methodName = "main", fileName = "test289.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test290.kt:10) test + +User code: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test290.MainTest", methodName = "main", fileName = "test290.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at MainTest.main(test291.kt:10) test + +User code: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test291.MainTest", methodName = "main", fileName = "test291.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test292.kt:10) test + +User code: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test292.MainTest", methodName = "main", fileName = "test292.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test293.kt:10) test + +User code: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test293.MainTest", methodName = "main", fileName = "test293.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at MainTest.main(test294.kt:10) test + +User code: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test294.MainTest", methodName = "main", fileName = "test294.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test295.kt:10) test + +User code: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test295.MainTest", methodName = "main", fileName = "test295.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test296.kt:10) test + +User code: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test296.MainTest", methodName = "main", fileName = "test296.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at MainTest.main(test297.kt:10) test + +User code: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test297.MainTest", methodName = "main", fileName = "test297.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at MainTest.main(test298.kt:10) test + +User code: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test298.MainTest", methodName = "main", fileName = "test298.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test299.kt:10) test + +User code: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test299.MainTest", methodName = "main", fileName = "test299.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at MainTest.main(test300.kt:10) test + +User code: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test300.MainTest", methodName = "main", fileName = "test300.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at MainTest.main(test304.kt:10) test + +User code: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test304.MainTest", methodName = "main", fileName = "test304.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test305.kt:10) test + +User code: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test305.MainTest", methodName = "main", fileName = "test305.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test306.kt:10) test + +User code: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test306.MainTest", methodName = "main", fileName = "test306.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at MainTest.main(test307.kt:10) test + +User code: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test307.MainTest", methodName = "main", fileName = "test307.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test308.kt:10) test + +User code: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test308.MainTest", methodName = "main", fileName = "test308.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test309.kt:10) test + +User code: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test309.MainTest", methodName = "main", fileName = "test309.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at MainTest.main(test310.kt:10) test + +User code: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test310.MainTest", methodName = "main", fileName = "test310.kt", lineNumber = 10) + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test311.kt:10) test + +User code: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test311.MainTest", methodName = "main", fileName = "test311.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test312.kt:10) test + +User code: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test312.MainTest", methodName = "main", fileName = "test312.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}") at MainTest.main(test316.kt:10) test + +User code: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") + } + +} +``` + +Transformed into: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test316.MainTest", methodName = "main", fileName = "test316.kt", lineNumber = 10) + } + +} +``` + +
+ +### error() { "error messageBuilder" } at MainTest.main(test317.kt:10) test + +User code: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test317.MainTest", methodName = "main", fileName = "test317.kt", lineNumber = 10) + } + +} +``` + +### error() { "error messageBuilder $i" } at MainTest.main(test318.kt:10) test + +User code: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test318.MainTest", methodName = "main", fileName = "test318.kt", lineNumber = 10) + } + +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at MainTest.main(test319.kt:10) test + +User code: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test319.MainTest", methodName = "main", fileName = "test319.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=null } at MainTest.main(test320.kt:10) test + +User code: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test320.MainTest", methodName = "main", fileName = "test320.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at MainTest.main(test321.kt:10) test + +User code: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test321.MainTest", methodName = "main", fileName = "test321.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test322.kt:10) test + +User code: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test322.MainTest", methodName = "main", fileName = "test322.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at MainTest.main(test323.kt:10) test + +User code: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test323.MainTest", methodName = "main", fileName = "test323.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at MainTest.main(test324.kt:10) test + +User code: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test324.MainTest", methodName = "main", fileName = "test324.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test325.kt:10) test + +User code: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test325.MainTest", methodName = "main", fileName = "test325.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
+ +
with class=false + +
entry/exit API + +### entry(argument1, argument2) at Test326Kt.main(test326.kt:10) test + +User code: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) +} +``` + +Transformed into: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entryWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "entry(argument1, argument2)", className = "test326.Test326Kt", methodName = "main", fileName = "test326.kt", lineNumber = 10)) +} +``` + +### exit(resultValue) at Test327Kt.main(test327.kt:10) test + +User code: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) +} +``` + +Transformed into: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "exit(resultValue)", className = "test327.Test327Kt", methodName = "main", fileName = "test327.kt", lineNumber = 10)) +} +``` + +### exit() at Test328Kt.main(test328.kt:10) test + +User code: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() +} +``` + +Transformed into: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(className = "test328.Test328Kt", methodName = "main", fileName = "test328.kt", lineNumber = 10)) +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at Test329Kt.main(test329.kt:10) test + +User code: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) +} +``` + +Transformed into: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "throwing(throwable)", className = "test329.Test329Kt", methodName = "main", fileName = "test329.kt", lineNumber = 10), throwable) +} +``` + +### catching(throwable) at Test330Kt.main(test330.kt:10) test + +User code: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) +} +``` + +Transformed into: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catchingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "catching(throwable)", className = "test330.Test330Kt", methodName = "main", fileName = "test330.kt", lineNumber = 10), throwable) +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at Test331Kt.main(test331.kt:10) test + +User code: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test331.Test331Kt", methodName = "main", fileName = "test331.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test332Kt.main(test332.kt:10) test + +User code: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test332.Test332Kt", methodName = "main", fileName = "test332.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test333Kt.main(test333.kt:10) test + +User code: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test333.Test333Kt", methodName = "main", fileName = "test333.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at Test334Kt.main(test334.kt:10) test + +User code: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test334.Test334Kt", methodName = "main", fileName = "test334.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at Test335Kt.main(test335.kt:10) test + +User code: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test335.Test335Kt", methodName = "main", fileName = "test335.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at Test336Kt.main(test336.kt:10) test + +User code: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test336.Test336Kt", methodName = "main", fileName = "test336.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at Test337Kt.main(test337.kt:10) test + +User code: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test337.Test337Kt", methodName = "main", fileName = "test337.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at Test338Kt.main(test338.kt:10) test + +User code: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test338.Test338Kt", methodName = "main", fileName = "test338.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at Test339Kt.main(test339.kt:10) test + +User code: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test339.Test339Kt", methodName = "main", fileName = "test339.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at Test340Kt.main(test340.kt:10) test + +User code: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test340.Test340Kt", methodName = "main", fileName = "test340.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at Test341Kt.main(test341.kt:10) test + +User code: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test341.Test341Kt", methodName = "main", fileName = "test341.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at Test342Kt.main(test342.kt:10) test + +User code: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test342.Test342Kt", methodName = "main", fileName = "test342.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test343Kt.main(test343.kt:10) test + +User code: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test343.Test343Kt", methodName = "main", fileName = "test343.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at Test344Kt.main(test344.kt:10) test + +User code: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test344.Test344Kt", methodName = "main", fileName = "test344.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at Test345Kt.main(test345.kt:10) test + +User code: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test345.Test345Kt", methodName = "main", fileName = "test345.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test346Kt.main(test346.kt:10) test + +User code: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test346.Test346Kt", methodName = "main", fileName = "test346.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at Test347Kt.main(test347.kt:10) test + +User code: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test347.Test347Kt", methodName = "main", fileName = "test347.kt", lineNumber = 10) +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test348Kt.main(test348.kt:10) test + +User code: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test348.Test348Kt", methodName = "main", fileName = "test348.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test349Kt.main(test349.kt:10) test + +User code: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test349.Test349Kt", methodName = "main", fileName = "test349.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}", throwable) at Test353Kt.main(test353.kt:10) test + +User code: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test353.Test353Kt", methodName = "main", fileName = "test353.kt", lineNumber = 10) +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at Test354Kt.main(test354.kt:10) test + +User code: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test354.Test354Kt", methodName = "main", fileName = "test354.kt", lineNumber = 10) +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at Test355Kt.main(test355.kt:10) test + +User code: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test355.Test355Kt", methodName = "main", fileName = "test355.kt", lineNumber = 10) +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at Test356Kt.main(test356.kt:10) test + +User code: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test356.Test356Kt", methodName = "main", fileName = "test356.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at Test357Kt.main(test357.kt:10) test + +User code: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test357.Test357Kt", methodName = "main", fileName = "test357.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at Test358Kt.main(test358.kt:10) test + +User code: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test358.Test358Kt", methodName = "main", fileName = "test358.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test359Kt.main(test359.kt:10) test + +User code: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test359.Test359Kt", methodName = "main", fileName = "test359.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at Test360Kt.main(test360.kt:10) test + +User code: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test360.Test360Kt", methodName = "main", fileName = "test360.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at Test361Kt.main(test361.kt:10) test + +User code: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test361.Test361Kt", methodName = "main", fileName = "test361.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test362Kt.main(test362.kt:10) test + +User code: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test362.Test362Kt", methodName = "main", fileName = "test362.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at Test363Kt.main(test363.kt:10) test + +User code: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test363.Test363Kt", methodName = "main", fileName = "test363.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test364Kt.main(test364.kt:10) test + +User code: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test364.Test364Kt", methodName = "main", fileName = "test364.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test365Kt.main(test365.kt:10) test + +User code: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test365.Test365Kt", methodName = "main", fileName = "test365.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at Test366Kt.main(test366.kt:10) test + +User code: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test366.Test366Kt", methodName = "main", fileName = "test366.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at Test367Kt.main(test367.kt:10) test + +User code: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test367.Test367Kt", methodName = "main", fileName = "test367.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at Test368Kt.main(test368.kt:10) test + +User code: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test368.Test368Kt", methodName = "main", fileName = "test368.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at Test369Kt.main(test369.kt:10) test + +User code: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test369.Test369Kt", methodName = "main", fileName = "test369.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at Test373Kt.main(test373.kt:10) test + +User code: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test373.Test373Kt", methodName = "main", fileName = "test373.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at Test374Kt.main(test374.kt:10) test + +User code: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test374.Test374Kt", methodName = "main", fileName = "test374.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test375Kt.main(test375.kt:10) test + +User code: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test375.Test375Kt", methodName = "main", fileName = "test375.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at Test376Kt.main(test376.kt:10) test + +User code: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test376.Test376Kt", methodName = "main", fileName = "test376.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at Test377Kt.main(test377.kt:10) test + +User code: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test377.Test377Kt", methodName = "main", fileName = "test377.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test378Kt.main(test378.kt:10) test + +User code: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test378.Test378Kt", methodName = "main", fileName = "test378.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at Test379Kt.main(test379.kt:10) test + +User code: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) +} +``` + +Transformed into: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test379.Test379Kt", methodName = "main", fileName = "test379.kt", lineNumber = 10) +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test380Kt.main(test380.kt:10) test + +User code: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test380.Test380Kt", methodName = "main", fileName = "test380.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test381Kt.main(test381.kt:10) test + +User code: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test381.Test381Kt", methodName = "main", fileName = "test381.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}") at Test385Kt.main(test385.kt:10) test + +User code: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") +} +``` + +Transformed into: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test385.Test385Kt", methodName = "main", fileName = "test385.kt", lineNumber = 10) +} +``` + +
+ +### trace() { "trace messageBuilder" } at Test386Kt.main(test386.kt:10) test + +User code: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test386.Test386Kt", methodName = "main", fileName = "test386.kt", lineNumber = 10) +} +``` + +### trace() { "trace messageBuilder $i" } at Test387Kt.main(test387.kt:10) test + +User code: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test387.Test387Kt", methodName = "main", fileName = "test387.kt", lineNumber = 10) +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at Test388Kt.main(test388.kt:10) test + +User code: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test388.Test388Kt", methodName = "main", fileName = "test388.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at Test389Kt.main(test389.kt:10) test + +User code: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test389.Test389Kt", methodName = "main", fileName = "test389.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at Test390Kt.main(test390.kt:10) test + +User code: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test390.Test390Kt", methodName = "main", fileName = "test390.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at Test391Kt.main(test391.kt:10) test + +User code: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test391.Test391Kt", methodName = "main", fileName = "test391.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at Test392Kt.main(test392.kt:10) test + +User code: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test392.Test392Kt", methodName = "main", fileName = "test392.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at Test393Kt.main(test393.kt:10) test + +User code: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test393.Test393Kt", methodName = "main", fileName = "test393.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test394Kt.main(test394.kt:10) test + +User code: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test394.Test394Kt", methodName = "main", fileName = "test394.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at Test395Kt.main(test395.kt:10) test + +User code: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test395.Test395Kt", methodName = "main", fileName = "test395.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test396Kt.main(test396.kt:10) test + +User code: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test396.Test396Kt", methodName = "main", fileName = "test396.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test397Kt.main(test397.kt:10) test + +User code: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test397.Test397Kt", methodName = "main", fileName = "test397.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at Test398Kt.main(test398.kt:10) test + +User code: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test398.Test398Kt", methodName = "main", fileName = "test398.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at Test399Kt.main(test399.kt:10) test + +User code: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test399.Test399Kt", methodName = "main", fileName = "test399.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at Test400Kt.main(test400.kt:10) test + +User code: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test400.Test400Kt", methodName = "main", fileName = "test400.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at Test401Kt.main(test401.kt:10) test + +User code: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test401.Test401Kt", methodName = "main", fileName = "test401.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at Test402Kt.main(test402.kt:10) test + +User code: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test402.Test402Kt", methodName = "main", fileName = "test402.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at Test403Kt.main(test403.kt:10) test + +User code: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test403.Test403Kt", methodName = "main", fileName = "test403.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at Test404Kt.main(test404.kt:10) test + +User code: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test404.Test404Kt", methodName = "main", fileName = "test404.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at Test405Kt.main(test405.kt:10) test + +User code: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test405.Test405Kt", methodName = "main", fileName = "test405.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at Test406Kt.main(test406.kt:10) test + +User code: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test406.Test406Kt", methodName = "main", fileName = "test406.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test407Kt.main(test407.kt:10) test + +User code: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test407.Test407Kt", methodName = "main", fileName = "test407.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at Test408Kt.main(test408.kt:10) test + +User code: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test408.Test408Kt", methodName = "main", fileName = "test408.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at Test409Kt.main(test409.kt:10) test + +User code: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test409.Test409Kt", methodName = "main", fileName = "test409.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test410Kt.main(test410.kt:10) test + +User code: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test410.Test410Kt", methodName = "main", fileName = "test410.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at Test411Kt.main(test411.kt:10) test + +User code: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test411.Test411Kt", methodName = "main", fileName = "test411.kt", lineNumber = 10) +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test412Kt.main(test412.kt:10) test + +User code: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test412.Test412Kt", methodName = "main", fileName = "test412.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test413Kt.main(test413.kt:10) test + +User code: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test413.Test413Kt", methodName = "main", fileName = "test413.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}", throwable) at Test417Kt.main(test417.kt:10) test + +User code: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test417.Test417Kt", methodName = "main", fileName = "test417.kt", lineNumber = 10) +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at Test418Kt.main(test418.kt:10) test + +User code: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test418.Test418Kt", methodName = "main", fileName = "test418.kt", lineNumber = 10) +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at Test419Kt.main(test419.kt:10) test + +User code: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test419.Test419Kt", methodName = "main", fileName = "test419.kt", lineNumber = 10) +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at Test420Kt.main(test420.kt:10) test + +User code: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test420.Test420Kt", methodName = "main", fileName = "test420.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at Test421Kt.main(test421.kt:10) test + +User code: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test421.Test421Kt", methodName = "main", fileName = "test421.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at Test422Kt.main(test422.kt:10) test + +User code: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test422.Test422Kt", methodName = "main", fileName = "test422.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test423Kt.main(test423.kt:10) test + +User code: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test423.Test423Kt", methodName = "main", fileName = "test423.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at Test424Kt.main(test424.kt:10) test + +User code: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test424.Test424Kt", methodName = "main", fileName = "test424.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at Test425Kt.main(test425.kt:10) test + +User code: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test425.Test425Kt", methodName = "main", fileName = "test425.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test426Kt.main(test426.kt:10) test + +User code: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test426.Test426Kt", methodName = "main", fileName = "test426.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at Test427Kt.main(test427.kt:10) test + +User code: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test427.Test427Kt", methodName = "main", fileName = "test427.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test428Kt.main(test428.kt:10) test + +User code: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test428.Test428Kt", methodName = "main", fileName = "test428.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test429Kt.main(test429.kt:10) test + +User code: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test429.Test429Kt", methodName = "main", fileName = "test429.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at Test430Kt.main(test430.kt:10) test + +User code: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test430.Test430Kt", methodName = "main", fileName = "test430.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at Test431Kt.main(test431.kt:10) test + +User code: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test431.Test431Kt", methodName = "main", fileName = "test431.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at Test432Kt.main(test432.kt:10) test + +User code: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test432.Test432Kt", methodName = "main", fileName = "test432.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at Test433Kt.main(test433.kt:10) test + +User code: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test433.Test433Kt", methodName = "main", fileName = "test433.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at Test437Kt.main(test437.kt:10) test + +User code: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test437.Test437Kt", methodName = "main", fileName = "test437.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at Test438Kt.main(test438.kt:10) test + +User code: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test438.Test438Kt", methodName = "main", fileName = "test438.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test439Kt.main(test439.kt:10) test + +User code: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test439.Test439Kt", methodName = "main", fileName = "test439.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at Test440Kt.main(test440.kt:10) test + +User code: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test440.Test440Kt", methodName = "main", fileName = "test440.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at Test441Kt.main(test441.kt:10) test + +User code: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test441.Test441Kt", methodName = "main", fileName = "test441.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test442Kt.main(test442.kt:10) test + +User code: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test442.Test442Kt", methodName = "main", fileName = "test442.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at Test443Kt.main(test443.kt:10) test + +User code: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) +} +``` + +Transformed into: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test443.Test443Kt", methodName = "main", fileName = "test443.kt", lineNumber = 10) +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test444Kt.main(test444.kt:10) test + +User code: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test444.Test444Kt", methodName = "main", fileName = "test444.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test445Kt.main(test445.kt:10) test + +User code: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test445.Test445Kt", methodName = "main", fileName = "test445.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}") at Test449Kt.main(test449.kt:10) test + +User code: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") +} +``` + +Transformed into: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test449.Test449Kt", methodName = "main", fileName = "test449.kt", lineNumber = 10) +} +``` + +
+ +### debug() { "debug messageBuilder" } at Test450Kt.main(test450.kt:10) test + +User code: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test450.Test450Kt", methodName = "main", fileName = "test450.kt", lineNumber = 10) +} +``` + +### debug() { "debug messageBuilder $i" } at Test451Kt.main(test451.kt:10) test + +User code: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test451.Test451Kt", methodName = "main", fileName = "test451.kt", lineNumber = 10) +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at Test452Kt.main(test452.kt:10) test + +User code: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test452.Test452Kt", methodName = "main", fileName = "test452.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at Test453Kt.main(test453.kt:10) test + +User code: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test453.Test453Kt", methodName = "main", fileName = "test453.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at Test454Kt.main(test454.kt:10) test + +User code: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test454.Test454Kt", methodName = "main", fileName = "test454.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at Test455Kt.main(test455.kt:10) test + +User code: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test455.Test455Kt", methodName = "main", fileName = "test455.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at Test456Kt.main(test456.kt:10) test + +User code: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test456.Test456Kt", methodName = "main", fileName = "test456.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at Test457Kt.main(test457.kt:10) test + +User code: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test457.Test457Kt", methodName = "main", fileName = "test457.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test458Kt.main(test458.kt:10) test + +User code: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test458.Test458Kt", methodName = "main", fileName = "test458.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at Test459Kt.main(test459.kt:10) test + +User code: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test459.Test459Kt", methodName = "main", fileName = "test459.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test460Kt.main(test460.kt:10) test + +User code: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test460.Test460Kt", methodName = "main", fileName = "test460.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test461Kt.main(test461.kt:10) test + +User code: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test461.Test461Kt", methodName = "main", fileName = "test461.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at Test462Kt.main(test462.kt:10) test + +User code: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test462.Test462Kt", methodName = "main", fileName = "test462.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at Test463Kt.main(test463.kt:10) test + +User code: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test463.Test463Kt", methodName = "main", fileName = "test463.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at Test464Kt.main(test464.kt:10) test + +User code: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test464.Test464Kt", methodName = "main", fileName = "test464.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at Test465Kt.main(test465.kt:10) test + +User code: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test465.Test465Kt", methodName = "main", fileName = "test465.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at Test466Kt.main(test466.kt:10) test + +User code: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test466.Test466Kt", methodName = "main", fileName = "test466.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at Test467Kt.main(test467.kt:10) test + +User code: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test467.Test467Kt", methodName = "main", fileName = "test467.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at Test468Kt.main(test468.kt:10) test + +User code: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test468.Test468Kt", methodName = "main", fileName = "test468.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at Test469Kt.main(test469.kt:10) test + +User code: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test469.Test469Kt", methodName = "main", fileName = "test469.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at Test470Kt.main(test470.kt:10) test + +User code: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test470.Test470Kt", methodName = "main", fileName = "test470.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test471Kt.main(test471.kt:10) test + +User code: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test471.Test471Kt", methodName = "main", fileName = "test471.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at Test472Kt.main(test472.kt:10) test + +User code: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test472.Test472Kt", methodName = "main", fileName = "test472.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at Test473Kt.main(test473.kt:10) test + +User code: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test473.Test473Kt", methodName = "main", fileName = "test473.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test474Kt.main(test474.kt:10) test + +User code: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test474.Test474Kt", methodName = "main", fileName = "test474.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at Test475Kt.main(test475.kt:10) test + +User code: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test475.Test475Kt", methodName = "main", fileName = "test475.kt", lineNumber = 10) +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test476Kt.main(test476.kt:10) test + +User code: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test476.Test476Kt", methodName = "main", fileName = "test476.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test477Kt.main(test477.kt:10) test + +User code: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test477.Test477Kt", methodName = "main", fileName = "test477.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### info("info message {}", throwable) at Test481Kt.main(test481.kt:10) test + +User code: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test481.Test481Kt", methodName = "main", fileName = "test481.kt", lineNumber = 10) +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at Test482Kt.main(test482.kt:10) test + +User code: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test482.Test482Kt", methodName = "main", fileName = "test482.kt", lineNumber = 10) +} +``` + +### info(throwable) { "info messageBuilder $i" } at Test483Kt.main(test483.kt:10) test + +User code: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test483.Test483Kt", methodName = "main", fileName = "test483.kt", lineNumber = 10) +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at Test484Kt.main(test484.kt:10) test + +User code: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test484.Test484Kt", methodName = "main", fileName = "test484.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at Test485Kt.main(test485.kt:10) test + +User code: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test485.Test485Kt", methodName = "main", fileName = "test485.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at Test486Kt.main(test486.kt:10) test + +User code: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test486.Test486Kt", methodName = "main", fileName = "test486.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test487Kt.main(test487.kt:10) test + +User code: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test487.Test487Kt", methodName = "main", fileName = "test487.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at Test488Kt.main(test488.kt:10) test + +User code: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test488.Test488Kt", methodName = "main", fileName = "test488.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at Test489Kt.main(test489.kt:10) test + +User code: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test489.Test489Kt", methodName = "main", fileName = "test489.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test490Kt.main(test490.kt:10) test + +User code: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test490.Test490Kt", methodName = "main", fileName = "test490.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at Test491Kt.main(test491.kt:10) test + +User code: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test491.Test491Kt", methodName = "main", fileName = "test491.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test492Kt.main(test492.kt:10) test + +User code: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test492.Test492Kt", methodName = "main", fileName = "test492.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test493Kt.main(test493.kt:10) test + +User code: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test493.Test493Kt", methodName = "main", fileName = "test493.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at Test494Kt.main(test494.kt:10) test + +User code: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test494.Test494Kt", methodName = "main", fileName = "test494.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at Test495Kt.main(test495.kt:10) test + +User code: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test495.Test495Kt", methodName = "main", fileName = "test495.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at Test496Kt.main(test496.kt:10) test + +User code: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test496.Test496Kt", methodName = "main", fileName = "test496.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at Test497Kt.main(test497.kt:10) test + +User code: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test497.Test497Kt", methodName = "main", fileName = "test497.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at Test501Kt.main(test501.kt:10) test + +User code: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test501.Test501Kt", methodName = "main", fileName = "test501.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at Test502Kt.main(test502.kt:10) test + +User code: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test502.Test502Kt", methodName = "main", fileName = "test502.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test503Kt.main(test503.kt:10) test + +User code: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test503.Test503Kt", methodName = "main", fileName = "test503.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at Test504Kt.main(test504.kt:10) test + +User code: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test504.Test504Kt", methodName = "main", fileName = "test504.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at Test505Kt.main(test505.kt:10) test + +User code: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test505.Test505Kt", methodName = "main", fileName = "test505.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test506Kt.main(test506.kt:10) test + +User code: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test506.Test506Kt", methodName = "main", fileName = "test506.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at Test507Kt.main(test507.kt:10) test + +User code: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) +} +``` + +Transformed into: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test507.Test507Kt", methodName = "main", fileName = "test507.kt", lineNumber = 10) +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test508Kt.main(test508.kt:10) test + +User code: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test508.Test508Kt", methodName = "main", fileName = "test508.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test509Kt.main(test509.kt:10) test + +User code: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test509.Test509Kt", methodName = "main", fileName = "test509.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### info("info message {}") at Test513Kt.main(test513.kt:10) test + +User code: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") +} +``` + +Transformed into: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test513.Test513Kt", methodName = "main", fileName = "test513.kt", lineNumber = 10) +} +``` + +
+ +### info() { "info messageBuilder" } at Test514Kt.main(test514.kt:10) test + +User code: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test514.Test514Kt", methodName = "main", fileName = "test514.kt", lineNumber = 10) +} +``` + +### info() { "info messageBuilder $i" } at Test515Kt.main(test515.kt:10) test + +User code: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test515.Test515Kt", methodName = "main", fileName = "test515.kt", lineNumber = 10) +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at Test516Kt.main(test516.kt:10) test + +User code: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test516.Test516Kt", methodName = "main", fileName = "test516.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=null } at Test517Kt.main(test517.kt:10) test + +User code: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test517.Test517Kt", methodName = "main", fileName = "test517.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at Test518Kt.main(test518.kt:10) test + +User code: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test518.Test518Kt", methodName = "main", fileName = "test518.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at Test519Kt.main(test519.kt:10) test + +User code: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test519.Test519Kt", methodName = "main", fileName = "test519.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at Test520Kt.main(test520.kt:10) test + +User code: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test520.Test520Kt", methodName = "main", fileName = "test520.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at Test521Kt.main(test521.kt:10) test + +User code: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test521.Test521Kt", methodName = "main", fileName = "test521.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at Test522Kt.main(test522.kt:10) test + +User code: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test522.Test522Kt", methodName = "main", fileName = "test522.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at Test523Kt.main(test523.kt:10) test + +User code: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test523.Test523Kt", methodName = "main", fileName = "test523.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test524Kt.main(test524.kt:10) test + +User code: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test524.Test524Kt", methodName = "main", fileName = "test524.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test525Kt.main(test525.kt:10) test + +User code: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test525.Test525Kt", methodName = "main", fileName = "test525.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at Test526Kt.main(test526.kt:10) test + +User code: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test526.Test526Kt", methodName = "main", fileName = "test526.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at Test527Kt.main(test527.kt:10) test + +User code: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test527.Test527Kt", methodName = "main", fileName = "test527.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at Test528Kt.main(test528.kt:10) test + +User code: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test528.Test528Kt", methodName = "main", fileName = "test528.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at Test529Kt.main(test529.kt:10) test + +User code: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test529.Test529Kt", methodName = "main", fileName = "test529.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at Test530Kt.main(test530.kt:10) test + +User code: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test530.Test530Kt", methodName = "main", fileName = "test530.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at Test531Kt.main(test531.kt:10) test + +User code: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test531.Test531Kt", methodName = "main", fileName = "test531.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at Test532Kt.main(test532.kt:10) test + +User code: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test532.Test532Kt", methodName = "main", fileName = "test532.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at Test533Kt.main(test533.kt:10) test + +User code: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test533.Test533Kt", methodName = "main", fileName = "test533.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at Test534Kt.main(test534.kt:10) test + +User code: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test534.Test534Kt", methodName = "main", fileName = "test534.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test535Kt.main(test535.kt:10) test + +User code: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test535.Test535Kt", methodName = "main", fileName = "test535.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at Test536Kt.main(test536.kt:10) test + +User code: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test536.Test536Kt", methodName = "main", fileName = "test536.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at Test537Kt.main(test537.kt:10) test + +User code: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test537.Test537Kt", methodName = "main", fileName = "test537.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test538Kt.main(test538.kt:10) test + +User code: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test538.Test538Kt", methodName = "main", fileName = "test538.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at Test539Kt.main(test539.kt:10) test + +User code: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test539.Test539Kt", methodName = "main", fileName = "test539.kt", lineNumber = 10) +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test540Kt.main(test540.kt:10) test + +User code: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test540.Test540Kt", methodName = "main", fileName = "test540.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test541Kt.main(test541.kt:10) test + +User code: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test541.Test541Kt", methodName = "main", fileName = "test541.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}", throwable) at Test545Kt.main(test545.kt:10) test + +User code: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test545.Test545Kt", methodName = "main", fileName = "test545.kt", lineNumber = 10) +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at Test546Kt.main(test546.kt:10) test + +User code: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test546.Test546Kt", methodName = "main", fileName = "test546.kt", lineNumber = 10) +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at Test547Kt.main(test547.kt:10) test + +User code: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test547.Test547Kt", methodName = "main", fileName = "test547.kt", lineNumber = 10) +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at Test548Kt.main(test548.kt:10) test + +User code: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test548.Test548Kt", methodName = "main", fileName = "test548.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at Test549Kt.main(test549.kt:10) test + +User code: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test549.Test549Kt", methodName = "main", fileName = "test549.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at Test550Kt.main(test550.kt:10) test + +User code: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test550.Test550Kt", methodName = "main", fileName = "test550.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test551Kt.main(test551.kt:10) test + +User code: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test551.Test551Kt", methodName = "main", fileName = "test551.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at Test552Kt.main(test552.kt:10) test + +User code: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test552.Test552Kt", methodName = "main", fileName = "test552.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at Test553Kt.main(test553.kt:10) test + +User code: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test553.Test553Kt", methodName = "main", fileName = "test553.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test554Kt.main(test554.kt:10) test + +User code: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test554.Test554Kt", methodName = "main", fileName = "test554.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at Test555Kt.main(test555.kt:10) test + +User code: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test555.Test555Kt", methodName = "main", fileName = "test555.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test556Kt.main(test556.kt:10) test + +User code: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test556.Test556Kt", methodName = "main", fileName = "test556.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test557Kt.main(test557.kt:10) test + +User code: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test557.Test557Kt", methodName = "main", fileName = "test557.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at Test558Kt.main(test558.kt:10) test + +User code: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test558.Test558Kt", methodName = "main", fileName = "test558.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at Test559Kt.main(test559.kt:10) test + +User code: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test559.Test559Kt", methodName = "main", fileName = "test559.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at Test560Kt.main(test560.kt:10) test + +User code: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test560.Test560Kt", methodName = "main", fileName = "test560.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at Test561Kt.main(test561.kt:10) test + +User code: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test561.Test561Kt", methodName = "main", fileName = "test561.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at Test565Kt.main(test565.kt:10) test + +User code: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test565.Test565Kt", methodName = "main", fileName = "test565.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at Test566Kt.main(test566.kt:10) test + +User code: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test566.Test566Kt", methodName = "main", fileName = "test566.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test567Kt.main(test567.kt:10) test + +User code: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test567.Test567Kt", methodName = "main", fileName = "test567.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at Test568Kt.main(test568.kt:10) test + +User code: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test568.Test568Kt", methodName = "main", fileName = "test568.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at Test569Kt.main(test569.kt:10) test + +User code: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test569.Test569Kt", methodName = "main", fileName = "test569.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test570Kt.main(test570.kt:10) test + +User code: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test570.Test570Kt", methodName = "main", fileName = "test570.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at Test571Kt.main(test571.kt:10) test + +User code: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) +} +``` + +Transformed into: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test571.Test571Kt", methodName = "main", fileName = "test571.kt", lineNumber = 10) +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test572Kt.main(test572.kt:10) test + +User code: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test572.Test572Kt", methodName = "main", fileName = "test572.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test573Kt.main(test573.kt:10) test + +User code: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test573.Test573Kt", methodName = "main", fileName = "test573.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}") at Test577Kt.main(test577.kt:10) test + +User code: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") +} +``` + +Transformed into: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test577.Test577Kt", methodName = "main", fileName = "test577.kt", lineNumber = 10) +} +``` + +
+ +### warn() { "warn messageBuilder" } at Test578Kt.main(test578.kt:10) test + +User code: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test578.Test578Kt", methodName = "main", fileName = "test578.kt", lineNumber = 10) +} +``` + +### warn() { "warn messageBuilder $i" } at Test579Kt.main(test579.kt:10) test + +User code: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test579.Test579Kt", methodName = "main", fileName = "test579.kt", lineNumber = 10) +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at Test580Kt.main(test580.kt:10) test + +User code: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test580.Test580Kt", methodName = "main", fileName = "test580.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at Test581Kt.main(test581.kt:10) test + +User code: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test581.Test581Kt", methodName = "main", fileName = "test581.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at Test582Kt.main(test582.kt:10) test + +User code: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test582.Test582Kt", methodName = "main", fileName = "test582.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at Test583Kt.main(test583.kt:10) test + +User code: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test583.Test583Kt", methodName = "main", fileName = "test583.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at Test584Kt.main(test584.kt:10) test + +User code: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test584.Test584Kt", methodName = "main", fileName = "test584.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at Test585Kt.main(test585.kt:10) test + +User code: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test585.Test585Kt", methodName = "main", fileName = "test585.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test586Kt.main(test586.kt:10) test + +User code: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test586.Test586Kt", methodName = "main", fileName = "test586.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at Test587Kt.main(test587.kt:10) test + +User code: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test587.Test587Kt", methodName = "main", fileName = "test587.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test588Kt.main(test588.kt:10) test + +User code: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test588.Test588Kt", methodName = "main", fileName = "test588.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test589Kt.main(test589.kt:10) test + +User code: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test589.Test589Kt", methodName = "main", fileName = "test589.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at Test590Kt.main(test590.kt:10) test + +User code: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test590.Test590Kt", methodName = "main", fileName = "test590.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at Test591Kt.main(test591.kt:10) test + +User code: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test591.Test591Kt", methodName = "main", fileName = "test591.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at Test592Kt.main(test592.kt:10) test + +User code: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test592.Test592Kt", methodName = "main", fileName = "test592.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at Test593Kt.main(test593.kt:10) test + +User code: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test593.Test593Kt", methodName = "main", fileName = "test593.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at Test594Kt.main(test594.kt:10) test + +User code: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test594.Test594Kt", methodName = "main", fileName = "test594.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at Test595Kt.main(test595.kt:10) test + +User code: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test595.Test595Kt", methodName = "main", fileName = "test595.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at Test596Kt.main(test596.kt:10) test + +User code: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test596.Test596Kt", methodName = "main", fileName = "test596.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at Test597Kt.main(test597.kt:10) test + +User code: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test597.Test597Kt", methodName = "main", fileName = "test597.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at Test598Kt.main(test598.kt:10) test + +User code: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test598.Test598Kt", methodName = "main", fileName = "test598.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test599Kt.main(test599.kt:10) test + +User code: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test599.Test599Kt", methodName = "main", fileName = "test599.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at Test600Kt.main(test600.kt:10) test + +User code: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test600.Test600Kt", methodName = "main", fileName = "test600.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at Test601Kt.main(test601.kt:10) test + +User code: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test601.Test601Kt", methodName = "main", fileName = "test601.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test602Kt.main(test602.kt:10) test + +User code: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test602.Test602Kt", methodName = "main", fileName = "test602.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at Test603Kt.main(test603.kt:10) test + +User code: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test603.Test603Kt", methodName = "main", fileName = "test603.kt", lineNumber = 10) +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test604Kt.main(test604.kt:10) test + +User code: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test604.Test604Kt", methodName = "main", fileName = "test604.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test605Kt.main(test605.kt:10) test + +User code: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test605.Test605Kt", methodName = "main", fileName = "test605.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### error("error message {}", throwable) at Test609Kt.main(test609.kt:10) test + +User code: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test609.Test609Kt", methodName = "main", fileName = "test609.kt", lineNumber = 10) +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at Test610Kt.main(test610.kt:10) test + +User code: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test610.Test610Kt", methodName = "main", fileName = "test610.kt", lineNumber = 10) +} +``` + +### error(throwable) { "error messageBuilder $i" } at Test611Kt.main(test611.kt:10) test + +User code: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test611.Test611Kt", methodName = "main", fileName = "test611.kt", lineNumber = 10) +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at Test612Kt.main(test612.kt:10) test + +User code: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test612.Test612Kt", methodName = "main", fileName = "test612.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=throwable } at Test613Kt.main(test613.kt:10) test + +User code: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test613.Test613Kt", methodName = "main", fileName = "test613.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at Test614Kt.main(test614.kt:10) test + +User code: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test614.Test614Kt", methodName = "main", fileName = "test614.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test615Kt.main(test615.kt:10) test + +User code: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test615.Test615Kt", methodName = "main", fileName = "test615.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at Test616Kt.main(test616.kt:10) test + +User code: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test616.Test616Kt", methodName = "main", fileName = "test616.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at Test617Kt.main(test617.kt:10) test + +User code: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test617.Test617Kt", methodName = "main", fileName = "test617.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test618Kt.main(test618.kt:10) test + +User code: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test618.Test618Kt", methodName = "main", fileName = "test618.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at Test619Kt.main(test619.kt:10) test + +User code: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test619.Test619Kt", methodName = "main", fileName = "test619.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test620Kt.main(test620.kt:10) test + +User code: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test620.Test620Kt", methodName = "main", fileName = "test620.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test621Kt.main(test621.kt:10) test + +User code: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test621.Test621Kt", methodName = "main", fileName = "test621.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at Test622Kt.main(test622.kt:10) test + +User code: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test622.Test622Kt", methodName = "main", fileName = "test622.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at Test623Kt.main(test623.kt:10) test + +User code: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test623.Test623Kt", methodName = "main", fileName = "test623.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at Test624Kt.main(test624.kt:10) test + +User code: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test624.Test624Kt", methodName = "main", fileName = "test624.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at Test625Kt.main(test625.kt:10) test + +User code: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test625.Test625Kt", methodName = "main", fileName = "test625.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at Test629Kt.main(test629.kt:10) test + +User code: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test629.Test629Kt", methodName = "main", fileName = "test629.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at Test630Kt.main(test630.kt:10) test + +User code: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test630.Test630Kt", methodName = "main", fileName = "test630.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test631Kt.main(test631.kt:10) test + +User code: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test631.Test631Kt", methodName = "main", fileName = "test631.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at Test632Kt.main(test632.kt:10) test + +User code: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test632.Test632Kt", methodName = "main", fileName = "test632.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at Test633Kt.main(test633.kt:10) test + +User code: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test633.Test633Kt", methodName = "main", fileName = "test633.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test634Kt.main(test634.kt:10) test + +User code: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test634.Test634Kt", methodName = "main", fileName = "test634.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at Test635Kt.main(test635.kt:10) test + +User code: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) +} +``` + +Transformed into: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test635.Test635Kt", methodName = "main", fileName = "test635.kt", lineNumber = 10) +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test636Kt.main(test636.kt:10) test + +User code: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test636.Test636Kt", methodName = "main", fileName = "test636.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test637Kt.main(test637.kt:10) test + +User code: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test637.Test637Kt", methodName = "main", fileName = "test637.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### error("error message {}") at Test641Kt.main(test641.kt:10) test + +User code: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") +} +``` + +Transformed into: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test641.Test641Kt", methodName = "main", fileName = "test641.kt", lineNumber = 10) +} +``` + +
+ +### error() { "error messageBuilder" } at Test642Kt.main(test642.kt:10) test + +User code: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test642.Test642Kt", methodName = "main", fileName = "test642.kt", lineNumber = 10) +} +``` + +### error() { "error messageBuilder $i" } at Test643Kt.main(test643.kt:10) test + +User code: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test643.Test643Kt", methodName = "main", fileName = "test643.kt", lineNumber = 10) +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at Test644Kt.main(test644.kt:10) test + +User code: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test644.Test644Kt", methodName = "main", fileName = "test644.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=null } at Test645Kt.main(test645.kt:10) test + +User code: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test645.Test645Kt", methodName = "main", fileName = "test645.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at Test646Kt.main(test646.kt:10) test + +User code: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test646.Test646Kt", methodName = "main", fileName = "test646.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at Test647Kt.main(test647.kt:10) test + +User code: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test647.Test647Kt", methodName = "main", fileName = "test647.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at Test648Kt.main(test648.kt:10) test + +User code: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test648.Test648Kt", methodName = "main", fileName = "test648.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at Test649Kt.main(test649.kt:10) test + +User code: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test649.Test649Kt", methodName = "main", fileName = "test649.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at Test650Kt.main(test650.kt:10) test + +User code: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test650.Test650Kt", methodName = "main", fileName = "test650.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
+ +
featureFlag=DISABLE_ALL + +
with class=true + +
entry/exit API + +### entry(argument1, argument2) at MainTest.main(test1.kt:10) test + +User code: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) + } + +} +``` + +Remains as-is: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) + } + +} +``` + +### exit(resultValue) at MainTest.main(test2.kt:10) test + +User code: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) + } + +} +``` + +Remains as-is: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) + } + +} +``` + +### exit() at MainTest.main(test3.kt:10) test + +User code: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() + } + +} +``` + +Remains as-is: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() + } + +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at MainTest.main(test4.kt:10) test + +User code: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) + } + +} +``` + +### catching(throwable) at MainTest.main(test5.kt:10) test + +User code: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) + } + +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at MainTest.main(test6.kt:10) test + +User code: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test7.kt:10) test + +User code: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test8.kt:10) test + +User code: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at MainTest.main(test9.kt:10) test + +User code: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at MainTest.main(test10.kt:10) test + +User code: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test11.kt:10) test + +User code: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at MainTest.main(test12.kt:10) test + +User code: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at MainTest.main(test13.kt:10) test + +User code: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at MainTest.main(test14.kt:10) test + +User code: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test15.kt:10) test + +User code: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test16.kt:10) test + +User code: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test17.kt:10) test + +User code: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test18.kt:10) test + +User code: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test19.kt:10) test + +User code: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test20.kt:10) test + +User code: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test21.kt:10) test + +User code: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at MainTest.main(test22.kt:10) test + +User code: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test23.kt:10) test + +User code: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test24.kt:10) test + +User code: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}", throwable) at MainTest.main(test28.kt:10) test + +User code: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) + } + +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at MainTest.main(test29.kt:10) test + +User code: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } + } + +} +``` + +Remains as-is: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at MainTest.main(test30.kt:10) test + +User code: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } + } + +} +``` + +Remains as-is: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test31.kt:10) test + +User code: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at MainTest.main(test32.kt:10) test + +User code: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test33.kt:10) test + +User code: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test34.kt:10) test + +User code: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test35.kt:10) test + +User code: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test36.kt:10) test + +User code: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test37.kt:10) test + +User code: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at MainTest.main(test38.kt:10) test + +User code: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test39.kt:10) test + +User code: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test40.kt:10) test + +User code: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at MainTest.main(test41.kt:10) test + +User code: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at MainTest.main(test42.kt:10) test + +User code: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test43.kt:10) test + +User code: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at MainTest.main(test44.kt:10) test + +User code: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test48.kt:10) test + +User code: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test49.kt:10) test + +User code: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test50.kt:10) test + +User code: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test51.kt:10) test + +User code: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test52.kt:10) test + +User code: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test53.kt:10) test + +User code: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at MainTest.main(test54.kt:10) test + +User code: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test55.kt:10) test + +User code: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test56.kt:10) test + +User code: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}") at MainTest.main(test60.kt:10) test + +User code: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") + } + +} +``` + +Remains as-is: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") + } + +} +``` + +
+ +### trace() { "trace messageBuilder" } at MainTest.main(test61.kt:10) test + +User code: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } + } + +} +``` + +Remains as-is: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } + } + +} +``` + +### trace() { "trace messageBuilder $i" } at MainTest.main(test62.kt:10) test + +User code: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } + } + +} +``` + +Remains as-is: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } + } + +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at MainTest.main(test63.kt:10) test + +User code: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at MainTest.main(test64.kt:10) test + +User code: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at MainTest.main(test65.kt:10) test + +User code: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test66.kt:10) test + +User code: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at MainTest.main(test67.kt:10) test + +User code: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test68.kt:10) test + +User code: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test69.kt:10) test + +User code: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at MainTest.main(test70.kt:10) test + +User code: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test71.kt:10) test + +User code: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test72.kt:10) test + +User code: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at MainTest.main(test73.kt:10) test + +User code: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at MainTest.main(test74.kt:10) test + +User code: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test75.kt:10) test + +User code: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at MainTest.main(test76.kt:10) test + +User code: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at MainTest.main(test77.kt:10) test + +User code: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at MainTest.main(test78.kt:10) test + +User code: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test79.kt:10) test + +User code: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test80.kt:10) test + +User code: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test81.kt:10) test + +User code: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test82.kt:10) test + +User code: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test83.kt:10) test + +User code: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test84.kt:10) test + +User code: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test85.kt:10) test + +User code: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at MainTest.main(test86.kt:10) test + +User code: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test87.kt:10) test + +User code: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test88.kt:10) test + +User code: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}", throwable) at MainTest.main(test92.kt:10) test + +User code: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) + } + +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at MainTest.main(test93.kt:10) test + +User code: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } + } + +} +``` + +Remains as-is: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at MainTest.main(test94.kt:10) test + +User code: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } + } + +} +``` + +Remains as-is: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test95.kt:10) test + +User code: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at MainTest.main(test96.kt:10) test + +User code: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test97.kt:10) test + +User code: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test98.kt:10) test + +User code: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test99.kt:10) test + +User code: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test100.kt:10) test + +User code: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test101.kt:10) test + +User code: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at MainTest.main(test102.kt:10) test + +User code: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test103.kt:10) test + +User code: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test104.kt:10) test + +User code: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at MainTest.main(test105.kt:10) test + +User code: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at MainTest.main(test106.kt:10) test + +User code: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test107.kt:10) test + +User code: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at MainTest.main(test108.kt:10) test + +User code: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test112.kt:10) test + +User code: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test113.kt:10) test + +User code: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test114.kt:10) test + +User code: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test115.kt:10) test + +User code: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test116.kt:10) test + +User code: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test117.kt:10) test + +User code: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at MainTest.main(test118.kt:10) test + +User code: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test119.kt:10) test + +User code: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test120.kt:10) test + +User code: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}") at MainTest.main(test124.kt:10) test + +User code: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") + } + +} +``` + +Remains as-is: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") + } + +} +``` + +
+ +### debug() { "debug messageBuilder" } at MainTest.main(test125.kt:10) test + +User code: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } + } + +} +``` + +Remains as-is: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } + } + +} +``` + +### debug() { "debug messageBuilder $i" } at MainTest.main(test126.kt:10) test + +User code: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } + } + +} +``` + +Remains as-is: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } + } + +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at MainTest.main(test127.kt:10) test + +User code: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at MainTest.main(test128.kt:10) test + +User code: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at MainTest.main(test129.kt:10) test + +User code: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test130.kt:10) test + +User code: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at MainTest.main(test131.kt:10) test + +User code: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test132.kt:10) test + +User code: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test133.kt:10) test + +User code: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at MainTest.main(test134.kt:10) test + +User code: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test135.kt:10) test + +User code: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test136.kt:10) test + +User code: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at MainTest.main(test137.kt:10) test + +User code: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at MainTest.main(test138.kt:10) test + +User code: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test139.kt:10) test + +User code: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at MainTest.main(test140.kt:10) test + +User code: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at MainTest.main(test141.kt:10) test + +User code: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at MainTest.main(test142.kt:10) test + +User code: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test143.kt:10) test + +User code: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test144.kt:10) test + +User code: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test145.kt:10) test + +User code: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test146.kt:10) test + +User code: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test147.kt:10) test + +User code: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test148.kt:10) test + +User code: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test149.kt:10) test + +User code: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at MainTest.main(test150.kt:10) test + +User code: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test151.kt:10) test + +User code: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test152.kt:10) test + +User code: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}", throwable) at MainTest.main(test156.kt:10) test + +User code: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) + } + +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at MainTest.main(test157.kt:10) test + +User code: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } + } + +} +``` + +Remains as-is: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } + } + +} +``` + +### info(throwable) { "info messageBuilder $i" } at MainTest.main(test158.kt:10) test + +User code: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } + } + +} +``` + +Remains as-is: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } + } + +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test159.kt:10) test + +User code: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at MainTest.main(test160.kt:10) test + +User code: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test161.kt:10) test + +User code: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test162.kt:10) test + +User code: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at MainTest.main(test163.kt:10) test + +User code: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test164.kt:10) test + +User code: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test165.kt:10) test + +User code: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at MainTest.main(test166.kt:10) test + +User code: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test167.kt:10) test + +User code: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test168.kt:10) test + +User code: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at MainTest.main(test169.kt:10) test + +User code: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at MainTest.main(test170.kt:10) test + +User code: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test171.kt:10) test + +User code: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at MainTest.main(test172.kt:10) test + +User code: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at MainTest.main(test176.kt:10) test + +User code: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test177.kt:10) test + +User code: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test178.kt:10) test + +User code: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at MainTest.main(test179.kt:10) test + +User code: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test180.kt:10) test + +User code: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test181.kt:10) test + +User code: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at MainTest.main(test182.kt:10) test + +User code: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test183.kt:10) test + +User code: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test184.kt:10) test + +User code: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}") at MainTest.main(test188.kt:10) test + +User code: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") + } + +} +``` + +Remains as-is: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") + } + +} +``` + +
+ +### info() { "info messageBuilder" } at MainTest.main(test189.kt:10) test + +User code: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } + } + +} +``` + +Remains as-is: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } + } + +} +``` + +### info() { "info messageBuilder $i" } at MainTest.main(test190.kt:10) test + +User code: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } + } + +} +``` + +Remains as-is: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } + } + +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at MainTest.main(test191.kt:10) test + +User code: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=null } at MainTest.main(test192.kt:10) test + +User code: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at MainTest.main(test193.kt:10) test + +User code: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test194.kt:10) test + +User code: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at MainTest.main(test195.kt:10) test + +User code: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at MainTest.main(test196.kt:10) test + +User code: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test197.kt:10) test + +User code: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at MainTest.main(test198.kt:10) test + +User code: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test199.kt:10) test + +User code: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test200.kt:10) test + +User code: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at MainTest.main(test201.kt:10) test + +User code: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at MainTest.main(test202.kt:10) test + +User code: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test203.kt:10) test + +User code: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at MainTest.main(test204.kt:10) test + +User code: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at MainTest.main(test205.kt:10) test + +User code: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at MainTest.main(test206.kt:10) test + +User code: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test207.kt:10) test + +User code: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test208.kt:10) test + +User code: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test209.kt:10) test + +User code: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test210.kt:10) test + +User code: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test211.kt:10) test + +User code: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test212.kt:10) test + +User code: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test213.kt:10) test + +User code: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at MainTest.main(test214.kt:10) test + +User code: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test215.kt:10) test + +User code: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test216.kt:10) test + +User code: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}", throwable) at MainTest.main(test220.kt:10) test + +User code: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) + } + +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at MainTest.main(test221.kt:10) test + +User code: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } + } + +} +``` + +Remains as-is: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at MainTest.main(test222.kt:10) test + +User code: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } + } + +} +``` + +Remains as-is: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test223.kt:10) test + +User code: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at MainTest.main(test224.kt:10) test + +User code: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test225.kt:10) test + +User code: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test226.kt:10) test + +User code: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test227.kt:10) test + +User code: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test228.kt:10) test + +User code: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test229.kt:10) test + +User code: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at MainTest.main(test230.kt:10) test + +User code: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test231.kt:10) test + +User code: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test232.kt:10) test + +User code: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at MainTest.main(test233.kt:10) test + +User code: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at MainTest.main(test234.kt:10) test + +User code: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test235.kt:10) test + +User code: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at MainTest.main(test236.kt:10) test + +User code: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test240.kt:10) test + +User code: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test241.kt:10) test + +User code: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test242.kt:10) test + +User code: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test243.kt:10) test + +User code: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test244.kt:10) test + +User code: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test245.kt:10) test + +User code: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at MainTest.main(test246.kt:10) test + +User code: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test247.kt:10) test + +User code: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test248.kt:10) test + +User code: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}") at MainTest.main(test252.kt:10) test + +User code: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") + } + +} +``` + +Remains as-is: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") + } + +} +``` + +
+ +### warn() { "warn messageBuilder" } at MainTest.main(test253.kt:10) test + +User code: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } + } + +} +``` + +Remains as-is: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } + } + +} +``` + +### warn() { "warn messageBuilder $i" } at MainTest.main(test254.kt:10) test + +User code: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } + } + +} +``` + +Remains as-is: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } + } + +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at MainTest.main(test255.kt:10) test + +User code: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at MainTest.main(test256.kt:10) test + +User code: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at MainTest.main(test257.kt:10) test + +User code: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test258.kt:10) test + +User code: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at MainTest.main(test259.kt:10) test + +User code: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test260.kt:10) test + +User code: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test261.kt:10) test + +User code: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at MainTest.main(test262.kt:10) test + +User code: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test263.kt:10) test + +User code: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test264.kt:10) test + +User code: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at MainTest.main(test265.kt:10) test + +User code: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at MainTest.main(test266.kt:10) test + +User code: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test267.kt:10) test + +User code: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at MainTest.main(test268.kt:10) test + +User code: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at MainTest.main(test269.kt:10) test + +User code: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at MainTest.main(test270.kt:10) test + +User code: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test271.kt:10) test + +User code: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test272.kt:10) test + +User code: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test273.kt:10) test + +User code: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test274.kt:10) test + +User code: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test275.kt:10) test + +User code: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test276.kt:10) test + +User code: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test277.kt:10) test + +User code: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at MainTest.main(test278.kt:10) test + +User code: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test279.kt:10) test + +User code: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test280.kt:10) test + +User code: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}", throwable) at MainTest.main(test284.kt:10) test + +User code: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) + } + +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at MainTest.main(test285.kt:10) test + +User code: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } + } + +} +``` + +Remains as-is: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } + } + +} +``` + +### error(throwable) { "error messageBuilder $i" } at MainTest.main(test286.kt:10) test + +User code: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } + } + +} +``` + +Remains as-is: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } + } + +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test287.kt:10) test + +User code: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=throwable } at MainTest.main(test288.kt:10) test + +User code: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test289.kt:10) test + +User code: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test290.kt:10) test + +User code: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at MainTest.main(test291.kt:10) test + +User code: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test292.kt:10) test + +User code: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Remains as-is: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test293.kt:10) test + +User code: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at MainTest.main(test294.kt:10) test + +User code: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test295.kt:10) test + +User code: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test296.kt:10) test + +User code: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at MainTest.main(test297.kt:10) test + +User code: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at MainTest.main(test298.kt:10) test + +User code: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test299.kt:10) test + +User code: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at MainTest.main(test300.kt:10) test + +User code: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at MainTest.main(test304.kt:10) test + +User code: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test305.kt:10) test + +User code: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test306.kt:10) test + +User code: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at MainTest.main(test307.kt:10) test + +User code: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test308.kt:10) test + +User code: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test309.kt:10) test + +User code: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at MainTest.main(test310.kt:10) test + +User code: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test311.kt:10) test + +User code: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test312.kt:10) test + +User code: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}") at MainTest.main(test316.kt:10) test + +User code: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") + } + +} +``` + +Remains as-is: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") + } + +} +``` + +
+ +### error() { "error messageBuilder" } at MainTest.main(test317.kt:10) test + +User code: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } + } + +} +``` + +Remains as-is: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } + } + +} +``` + +### error() { "error messageBuilder $i" } at MainTest.main(test318.kt:10) test + +User code: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } + } + +} +``` + +Remains as-is: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } + } + +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at MainTest.main(test319.kt:10) test + +User code: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=null } at MainTest.main(test320.kt:10) test + +User code: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at MainTest.main(test321.kt:10) test + +User code: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test322.kt:10) test + +User code: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at MainTest.main(test323.kt:10) test + +User code: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at MainTest.main(test324.kt:10) test + +User code: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Remains as-is: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test325.kt:10) test + +User code: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
+ +
with class=false + +
entry/exit API + +### entry(argument1, argument2) at Test326Kt.main(test326.kt:10) test + +User code: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) +} +``` + +Remains as-is: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) +} +``` + +### exit(resultValue) at Test327Kt.main(test327.kt:10) test + +User code: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) +} +``` + +Remains as-is: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) +} +``` + +### exit() at Test328Kt.main(test328.kt:10) test + +User code: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() +} +``` + +Remains as-is: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at Test329Kt.main(test329.kt:10) test + +User code: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) +} +``` + +Remains as-is: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) +} +``` + +### catching(throwable) at Test330Kt.main(test330.kt:10) test + +User code: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) +} +``` + +Remains as-is: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at Test331Kt.main(test331.kt:10) test + +User code: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test332Kt.main(test332.kt:10) test + +User code: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test333Kt.main(test333.kt:10) test + +User code: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at Test334Kt.main(test334.kt:10) test + +User code: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at Test335Kt.main(test335.kt:10) test + +User code: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at Test336Kt.main(test336.kt:10) test + +User code: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at Test337Kt.main(test337.kt:10) test + +User code: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at Test338Kt.main(test338.kt:10) test + +User code: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at Test339Kt.main(test339.kt:10) test + +User code: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at Test340Kt.main(test340.kt:10) test + +User code: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at Test341Kt.main(test341.kt:10) test + +User code: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at Test342Kt.main(test342.kt:10) test + +User code: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test343Kt.main(test343.kt:10) test + +User code: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at Test344Kt.main(test344.kt:10) test + +User code: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at Test345Kt.main(test345.kt:10) test + +User code: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test346Kt.main(test346.kt:10) test + +User code: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at Test347Kt.main(test347.kt:10) test + +User code: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test348Kt.main(test348.kt:10) test + +User code: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test349Kt.main(test349.kt:10) test + +User code: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}", throwable) at Test353Kt.main(test353.kt:10) test + +User code: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) +} +``` + +Remains as-is: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at Test354Kt.main(test354.kt:10) test + +User code: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } +} +``` + +Remains as-is: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at Test355Kt.main(test355.kt:10) test + +User code: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } +} +``` + +Remains as-is: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at Test356Kt.main(test356.kt:10) test + +User code: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at Test357Kt.main(test357.kt:10) test + +User code: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at Test358Kt.main(test358.kt:10) test + +User code: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test359Kt.main(test359.kt:10) test + +User code: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at Test360Kt.main(test360.kt:10) test + +User code: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at Test361Kt.main(test361.kt:10) test + +User code: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test362Kt.main(test362.kt:10) test + +User code: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at Test363Kt.main(test363.kt:10) test + +User code: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test364Kt.main(test364.kt:10) test + +User code: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test365Kt.main(test365.kt:10) test + +User code: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at Test366Kt.main(test366.kt:10) test + +User code: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at Test367Kt.main(test367.kt:10) test + +User code: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at Test368Kt.main(test368.kt:10) test + +User code: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at Test369Kt.main(test369.kt:10) test + +User code: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at Test373Kt.main(test373.kt:10) test + +User code: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at Test374Kt.main(test374.kt:10) test + +User code: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test375Kt.main(test375.kt:10) test + +User code: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at Test376Kt.main(test376.kt:10) test + +User code: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at Test377Kt.main(test377.kt:10) test + +User code: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test378Kt.main(test378.kt:10) test + +User code: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at Test379Kt.main(test379.kt:10) test + +User code: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test380Kt.main(test380.kt:10) test + +User code: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test381Kt.main(test381.kt:10) test + +User code: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}") at Test385Kt.main(test385.kt:10) test + +User code: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") +} +``` + +Remains as-is: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") +} +``` + +
+ +### trace() { "trace messageBuilder" } at Test386Kt.main(test386.kt:10) test + +User code: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } +} +``` + +Remains as-is: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } +} +``` + +### trace() { "trace messageBuilder $i" } at Test387Kt.main(test387.kt:10) test + +User code: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } +} +``` + +Remains as-is: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at Test388Kt.main(test388.kt:10) test + +User code: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at Test389Kt.main(test389.kt:10) test + +User code: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at Test390Kt.main(test390.kt:10) test + +User code: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at Test391Kt.main(test391.kt:10) test + +User code: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at Test392Kt.main(test392.kt:10) test + +User code: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at Test393Kt.main(test393.kt:10) test + +User code: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test394Kt.main(test394.kt:10) test + +User code: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at Test395Kt.main(test395.kt:10) test + +User code: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test396Kt.main(test396.kt:10) test + +User code: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test397Kt.main(test397.kt:10) test + +User code: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at Test398Kt.main(test398.kt:10) test + +User code: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at Test399Kt.main(test399.kt:10) test + +User code: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at Test400Kt.main(test400.kt:10) test + +User code: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at Test401Kt.main(test401.kt:10) test + +User code: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at Test402Kt.main(test402.kt:10) test + +User code: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at Test403Kt.main(test403.kt:10) test + +User code: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at Test404Kt.main(test404.kt:10) test + +User code: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at Test405Kt.main(test405.kt:10) test + +User code: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at Test406Kt.main(test406.kt:10) test + +User code: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test407Kt.main(test407.kt:10) test + +User code: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at Test408Kt.main(test408.kt:10) test + +User code: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at Test409Kt.main(test409.kt:10) test + +User code: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test410Kt.main(test410.kt:10) test + +User code: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at Test411Kt.main(test411.kt:10) test + +User code: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test412Kt.main(test412.kt:10) test + +User code: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test413Kt.main(test413.kt:10) test + +User code: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}", throwable) at Test417Kt.main(test417.kt:10) test + +User code: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) +} +``` + +Remains as-is: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at Test418Kt.main(test418.kt:10) test + +User code: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } +} +``` + +Remains as-is: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at Test419Kt.main(test419.kt:10) test + +User code: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } +} +``` + +Remains as-is: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at Test420Kt.main(test420.kt:10) test + +User code: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at Test421Kt.main(test421.kt:10) test + +User code: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at Test422Kt.main(test422.kt:10) test + +User code: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test423Kt.main(test423.kt:10) test + +User code: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at Test424Kt.main(test424.kt:10) test + +User code: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at Test425Kt.main(test425.kt:10) test + +User code: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test426Kt.main(test426.kt:10) test + +User code: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at Test427Kt.main(test427.kt:10) test + +User code: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test428Kt.main(test428.kt:10) test + +User code: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test429Kt.main(test429.kt:10) test + +User code: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at Test430Kt.main(test430.kt:10) test + +User code: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at Test431Kt.main(test431.kt:10) test + +User code: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at Test432Kt.main(test432.kt:10) test + +User code: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at Test433Kt.main(test433.kt:10) test + +User code: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at Test437Kt.main(test437.kt:10) test + +User code: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at Test438Kt.main(test438.kt:10) test + +User code: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test439Kt.main(test439.kt:10) test + +User code: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at Test440Kt.main(test440.kt:10) test + +User code: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at Test441Kt.main(test441.kt:10) test + +User code: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test442Kt.main(test442.kt:10) test + +User code: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at Test443Kt.main(test443.kt:10) test + +User code: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test444Kt.main(test444.kt:10) test + +User code: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test445Kt.main(test445.kt:10) test + +User code: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}") at Test449Kt.main(test449.kt:10) test + +User code: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") +} +``` + +Remains as-is: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") +} +``` + +
+ +### debug() { "debug messageBuilder" } at Test450Kt.main(test450.kt:10) test + +User code: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } +} +``` + +Remains as-is: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } +} +``` + +### debug() { "debug messageBuilder $i" } at Test451Kt.main(test451.kt:10) test + +User code: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } +} +``` + +Remains as-is: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at Test452Kt.main(test452.kt:10) test + +User code: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at Test453Kt.main(test453.kt:10) test + +User code: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at Test454Kt.main(test454.kt:10) test + +User code: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at Test455Kt.main(test455.kt:10) test + +User code: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at Test456Kt.main(test456.kt:10) test + +User code: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at Test457Kt.main(test457.kt:10) test + +User code: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test458Kt.main(test458.kt:10) test + +User code: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at Test459Kt.main(test459.kt:10) test + +User code: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test460Kt.main(test460.kt:10) test + +User code: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test461Kt.main(test461.kt:10) test + +User code: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at Test462Kt.main(test462.kt:10) test + +User code: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at Test463Kt.main(test463.kt:10) test + +User code: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at Test464Kt.main(test464.kt:10) test + +User code: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at Test465Kt.main(test465.kt:10) test + +User code: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at Test466Kt.main(test466.kt:10) test + +User code: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at Test467Kt.main(test467.kt:10) test + +User code: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at Test468Kt.main(test468.kt:10) test + +User code: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at Test469Kt.main(test469.kt:10) test + +User code: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at Test470Kt.main(test470.kt:10) test + +User code: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test471Kt.main(test471.kt:10) test + +User code: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at Test472Kt.main(test472.kt:10) test + +User code: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at Test473Kt.main(test473.kt:10) test + +User code: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test474Kt.main(test474.kt:10) test + +User code: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at Test475Kt.main(test475.kt:10) test + +User code: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test476Kt.main(test476.kt:10) test + +User code: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test477Kt.main(test477.kt:10) test + +User code: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### info("info message {}", throwable) at Test481Kt.main(test481.kt:10) test + +User code: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) +} +``` + +Remains as-is: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at Test482Kt.main(test482.kt:10) test + +User code: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } +} +``` + +Remains as-is: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } +} +``` + +### info(throwable) { "info messageBuilder $i" } at Test483Kt.main(test483.kt:10) test + +User code: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } +} +``` + +Remains as-is: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at Test484Kt.main(test484.kt:10) test + +User code: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at Test485Kt.main(test485.kt:10) test + +User code: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at Test486Kt.main(test486.kt:10) test + +User code: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test487Kt.main(test487.kt:10) test + +User code: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at Test488Kt.main(test488.kt:10) test + +User code: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at Test489Kt.main(test489.kt:10) test + +User code: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test490Kt.main(test490.kt:10) test + +User code: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at Test491Kt.main(test491.kt:10) test + +User code: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test492Kt.main(test492.kt:10) test + +User code: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test493Kt.main(test493.kt:10) test + +User code: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at Test494Kt.main(test494.kt:10) test + +User code: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at Test495Kt.main(test495.kt:10) test + +User code: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at Test496Kt.main(test496.kt:10) test + +User code: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at Test497Kt.main(test497.kt:10) test + +User code: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at Test501Kt.main(test501.kt:10) test + +User code: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at Test502Kt.main(test502.kt:10) test + +User code: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test503Kt.main(test503.kt:10) test + +User code: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at Test504Kt.main(test504.kt:10) test + +User code: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at Test505Kt.main(test505.kt:10) test + +User code: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test506Kt.main(test506.kt:10) test + +User code: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at Test507Kt.main(test507.kt:10) test + +User code: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test508Kt.main(test508.kt:10) test + +User code: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test509Kt.main(test509.kt:10) test + +User code: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### info("info message {}") at Test513Kt.main(test513.kt:10) test + +User code: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") +} +``` + +Remains as-is: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") +} +``` + +
+ +### info() { "info messageBuilder" } at Test514Kt.main(test514.kt:10) test + +User code: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } +} +``` + +Remains as-is: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } +} +``` + +### info() { "info messageBuilder $i" } at Test515Kt.main(test515.kt:10) test + +User code: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } +} +``` + +Remains as-is: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at Test516Kt.main(test516.kt:10) test + +User code: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=null } at Test517Kt.main(test517.kt:10) test + +User code: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at Test518Kt.main(test518.kt:10) test + +User code: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at Test519Kt.main(test519.kt:10) test + +User code: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at Test520Kt.main(test520.kt:10) test + +User code: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at Test521Kt.main(test521.kt:10) test + +User code: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at Test522Kt.main(test522.kt:10) test + +User code: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at Test523Kt.main(test523.kt:10) test + +User code: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test524Kt.main(test524.kt:10) test + +User code: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test525Kt.main(test525.kt:10) test + +User code: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at Test526Kt.main(test526.kt:10) test + +User code: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at Test527Kt.main(test527.kt:10) test + +User code: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at Test528Kt.main(test528.kt:10) test + +User code: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at Test529Kt.main(test529.kt:10) test + +User code: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at Test530Kt.main(test530.kt:10) test + +User code: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at Test531Kt.main(test531.kt:10) test + +User code: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at Test532Kt.main(test532.kt:10) test + +User code: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at Test533Kt.main(test533.kt:10) test + +User code: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at Test534Kt.main(test534.kt:10) test + +User code: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test535Kt.main(test535.kt:10) test + +User code: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at Test536Kt.main(test536.kt:10) test + +User code: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at Test537Kt.main(test537.kt:10) test + +User code: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test538Kt.main(test538.kt:10) test + +User code: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at Test539Kt.main(test539.kt:10) test + +User code: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test540Kt.main(test540.kt:10) test + +User code: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test541Kt.main(test541.kt:10) test + +User code: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}", throwable) at Test545Kt.main(test545.kt:10) test + +User code: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) +} +``` + +Remains as-is: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at Test546Kt.main(test546.kt:10) test + +User code: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } +} +``` + +Remains as-is: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at Test547Kt.main(test547.kt:10) test + +User code: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } +} +``` + +Remains as-is: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at Test548Kt.main(test548.kt:10) test + +User code: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at Test549Kt.main(test549.kt:10) test + +User code: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at Test550Kt.main(test550.kt:10) test + +User code: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test551Kt.main(test551.kt:10) test + +User code: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at Test552Kt.main(test552.kt:10) test + +User code: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at Test553Kt.main(test553.kt:10) test + +User code: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test554Kt.main(test554.kt:10) test + +User code: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at Test555Kt.main(test555.kt:10) test + +User code: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test556Kt.main(test556.kt:10) test + +User code: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test557Kt.main(test557.kt:10) test + +User code: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at Test558Kt.main(test558.kt:10) test + +User code: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at Test559Kt.main(test559.kt:10) test + +User code: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at Test560Kt.main(test560.kt:10) test + +User code: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at Test561Kt.main(test561.kt:10) test + +User code: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at Test565Kt.main(test565.kt:10) test + +User code: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at Test566Kt.main(test566.kt:10) test + +User code: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test567Kt.main(test567.kt:10) test + +User code: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at Test568Kt.main(test568.kt:10) test + +User code: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at Test569Kt.main(test569.kt:10) test + +User code: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test570Kt.main(test570.kt:10) test + +User code: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at Test571Kt.main(test571.kt:10) test + +User code: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test572Kt.main(test572.kt:10) test + +User code: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test573Kt.main(test573.kt:10) test + +User code: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}") at Test577Kt.main(test577.kt:10) test + +User code: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") +} +``` + +Remains as-is: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") +} +``` + +
+ +### warn() { "warn messageBuilder" } at Test578Kt.main(test578.kt:10) test + +User code: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } +} +``` + +Remains as-is: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } +} +``` + +### warn() { "warn messageBuilder $i" } at Test579Kt.main(test579.kt:10) test + +User code: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } +} +``` + +Remains as-is: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at Test580Kt.main(test580.kt:10) test + +User code: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at Test581Kt.main(test581.kt:10) test + +User code: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at Test582Kt.main(test582.kt:10) test + +User code: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at Test583Kt.main(test583.kt:10) test + +User code: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at Test584Kt.main(test584.kt:10) test + +User code: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at Test585Kt.main(test585.kt:10) test + +User code: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test586Kt.main(test586.kt:10) test + +User code: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at Test587Kt.main(test587.kt:10) test + +User code: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test588Kt.main(test588.kt:10) test + +User code: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test589Kt.main(test589.kt:10) test + +User code: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at Test590Kt.main(test590.kt:10) test + +User code: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at Test591Kt.main(test591.kt:10) test + +User code: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at Test592Kt.main(test592.kt:10) test + +User code: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at Test593Kt.main(test593.kt:10) test + +User code: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at Test594Kt.main(test594.kt:10) test + +User code: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at Test595Kt.main(test595.kt:10) test + +User code: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at Test596Kt.main(test596.kt:10) test + +User code: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at Test597Kt.main(test597.kt:10) test + +User code: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at Test598Kt.main(test598.kt:10) test + +User code: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test599Kt.main(test599.kt:10) test + +User code: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at Test600Kt.main(test600.kt:10) test + +User code: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at Test601Kt.main(test601.kt:10) test + +User code: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test602Kt.main(test602.kt:10) test + +User code: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at Test603Kt.main(test603.kt:10) test + +User code: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test604Kt.main(test604.kt:10) test + +User code: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test605Kt.main(test605.kt:10) test + +User code: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### error("error message {}", throwable) at Test609Kt.main(test609.kt:10) test + +User code: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) +} +``` + +Remains as-is: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at Test610Kt.main(test610.kt:10) test + +User code: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } +} +``` + +Remains as-is: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } +} +``` + +### error(throwable) { "error messageBuilder $i" } at Test611Kt.main(test611.kt:10) test + +User code: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } +} +``` + +Remains as-is: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at Test612Kt.main(test612.kt:10) test + +User code: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=throwable } at Test613Kt.main(test613.kt:10) test + +User code: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at Test614Kt.main(test614.kt:10) test + +User code: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test615Kt.main(test615.kt:10) test + +User code: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at Test616Kt.main(test616.kt:10) test + +User code: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at Test617Kt.main(test617.kt:10) test + +User code: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } +} +``` + +Remains as-is: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test618Kt.main(test618.kt:10) test + +User code: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at Test619Kt.main(test619.kt:10) test + +User code: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test620Kt.main(test620.kt:10) test + +User code: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test621Kt.main(test621.kt:10) test + +User code: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at Test622Kt.main(test622.kt:10) test + +User code: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at Test623Kt.main(test623.kt:10) test + +User code: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at Test624Kt.main(test624.kt:10) test + +User code: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at Test625Kt.main(test625.kt:10) test + +User code: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at Test629Kt.main(test629.kt:10) test + +User code: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at Test630Kt.main(test630.kt:10) test + +User code: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test631Kt.main(test631.kt:10) test + +User code: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at Test632Kt.main(test632.kt:10) test + +User code: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at Test633Kt.main(test633.kt:10) test + +User code: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test634Kt.main(test634.kt:10) test + +User code: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at Test635Kt.main(test635.kt:10) test + +User code: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test636Kt.main(test636.kt:10) test + +User code: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test637Kt.main(test637.kt:10) test + +User code: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### error("error message {}") at Test641Kt.main(test641.kt:10) test + +User code: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") +} +``` + +Remains as-is: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") +} +``` + +
+ +### error() { "error messageBuilder" } at Test642Kt.main(test642.kt:10) test + +User code: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } +} +``` + +Remains as-is: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } +} +``` + +### error() { "error messageBuilder $i" } at Test643Kt.main(test643.kt:10) test + +User code: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } +} +``` + +Remains as-is: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at Test644Kt.main(test644.kt:10) test + +User code: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=null } at Test645Kt.main(test645.kt:10) test + +User code: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at Test646Kt.main(test646.kt:10) test + +User code: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at Test647Kt.main(test647.kt:10) test + +User code: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at Test648Kt.main(test648.kt:10) test + +User code: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at Test649Kt.main(test649.kt:10) test + +User code: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } +} +``` + +Remains as-is: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at Test650Kt.main(test650.kt:10) test + +User code: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
+ +
featureFlag=DISABLE_TRANSFORMING_NOT_IMPLEMENTED_API + +
with class=true + +
entry/exit API + +### entry(argument1, argument2) at MainTest.main(test1.kt:10) test + +User code: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) + } + +} +``` + +Transformed into: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entryWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "entry(argument1, argument2)", className = "test1.MainTest", methodName = "main", fileName = "test1.kt", lineNumber = 10)) + } + +} +``` + +### exit(resultValue) at MainTest.main(test2.kt:10) test + +User code: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) + } + +} +``` + +Transformed into: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "exit(resultValue)", className = "test2.MainTest", methodName = "main", fileName = "test2.kt", lineNumber = 10)) + } + +} +``` + +### exit() at MainTest.main(test3.kt:10) test + +User code: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() + } + +} +``` + +Transformed into: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(className = "test3.MainTest", methodName = "main", fileName = "test3.kt", lineNumber = 10)) + } + +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at MainTest.main(test4.kt:10) test + +User code: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) + } + +} +``` + +Transformed into: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "throwing(throwable)", className = "test4.MainTest", methodName = "main", fileName = "test4.kt", lineNumber = 10), throwable) + } + +} +``` + +### catching(throwable) at MainTest.main(test5.kt:10) test + +User code: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) + } + +} +``` + +Transformed into: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catchingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "catching(throwable)", className = "test5.MainTest", methodName = "main", fileName = "test5.kt", lineNumber = 10), throwable) + } + +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at MainTest.main(test6.kt:10) test + +User code: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test7.kt:10) test + +User code: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test8.kt:10) test + +User code: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at MainTest.main(test9.kt:10) test + +User code: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test9.MainTest", methodName = "main", fileName = "test9.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at MainTest.main(test10.kt:10) test + +User code: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test10.MainTest", methodName = "main", fileName = "test10.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test11.kt:10) test + +User code: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test11.MainTest", methodName = "main", fileName = "test11.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at MainTest.main(test12.kt:10) test + +User code: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test12.MainTest", methodName = "main", fileName = "test12.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at MainTest.main(test13.kt:10) test + +User code: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test13.MainTest", methodName = "main", fileName = "test13.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at MainTest.main(test14.kt:10) test + +User code: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test14.MainTest", methodName = "main", fileName = "test14.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test15.kt:10) test + +User code: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test15.MainTest", methodName = "main", fileName = "test15.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test16.kt:10) test + +User code: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test16.MainTest", methodName = "main", fileName = "test16.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test17.kt:10) test + +User code: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test17.MainTest", methodName = "main", fileName = "test17.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test18.kt:10) test + +User code: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test18.MainTest", methodName = "main", fileName = "test18.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test19.kt:10) test + +User code: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test19.MainTest", methodName = "main", fileName = "test19.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test20.kt:10) test + +User code: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test20.MainTest", methodName = "main", fileName = "test20.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test21.kt:10) test + +User code: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test21.MainTest", methodName = "main", fileName = "test21.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at MainTest.main(test22.kt:10) test + +User code: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test23.kt:10) test + +User code: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test24.kt:10) test + +User code: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}", throwable) at MainTest.main(test28.kt:10) test + +User code: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test28.MainTest", methodName = "main", fileName = "test28.kt", lineNumber = 10) + } + +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at MainTest.main(test29.kt:10) test + +User code: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test29.MainTest", methodName = "main", fileName = "test29.kt", lineNumber = 10) + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at MainTest.main(test30.kt:10) test + +User code: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test30.MainTest", methodName = "main", fileName = "test30.kt", lineNumber = 10) + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test31.kt:10) test + +User code: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test31.MainTest", methodName = "main", fileName = "test31.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at MainTest.main(test32.kt:10) test + +User code: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test32.MainTest", methodName = "main", fileName = "test32.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test33.kt:10) test + +User code: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test33.MainTest", methodName = "main", fileName = "test33.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test34.kt:10) test + +User code: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test34.MainTest", methodName = "main", fileName = "test34.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test35.kt:10) test + +User code: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test35.MainTest", methodName = "main", fileName = "test35.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test36.kt:10) test + +User code: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test36.MainTest", methodName = "main", fileName = "test36.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test37.kt:10) test + +User code: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test37.MainTest", methodName = "main", fileName = "test37.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at MainTest.main(test38.kt:10) test + +User code: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test39.kt:10) test + +User code: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test40.kt:10) test + +User code: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at MainTest.main(test41.kt:10) test + +User code: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test41.MainTest", methodName = "main", fileName = "test41.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at MainTest.main(test42.kt:10) test + +User code: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test42.MainTest", methodName = "main", fileName = "test42.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test43.kt:10) test + +User code: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test43.MainTest", methodName = "main", fileName = "test43.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at MainTest.main(test44.kt:10) test + +User code: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test44.MainTest", methodName = "main", fileName = "test44.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test48.kt:10) test + +User code: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test48.MainTest", methodName = "main", fileName = "test48.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test49.kt:10) test + +User code: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test49.MainTest", methodName = "main", fileName = "test49.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test50.kt:10) test + +User code: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test50.MainTest", methodName = "main", fileName = "test50.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test51.kt:10) test + +User code: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test51.MainTest", methodName = "main", fileName = "test51.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test52.kt:10) test + +User code: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test52.MainTest", methodName = "main", fileName = "test52.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test53.kt:10) test + +User code: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test53.MainTest", methodName = "main", fileName = "test53.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at MainTest.main(test54.kt:10) test + +User code: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test55.kt:10) test + +User code: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test56.kt:10) test + +User code: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}") at MainTest.main(test60.kt:10) test + +User code: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") + } + +} +``` + +Transformed into: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test60.MainTest", methodName = "main", fileName = "test60.kt", lineNumber = 10) + } + +} +``` + +
+ +### trace() { "trace messageBuilder" } at MainTest.main(test61.kt:10) test + +User code: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test61.MainTest", methodName = "main", fileName = "test61.kt", lineNumber = 10) + } + +} +``` + +### trace() { "trace messageBuilder $i" } at MainTest.main(test62.kt:10) test + +User code: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test62.MainTest", methodName = "main", fileName = "test62.kt", lineNumber = 10) + } + +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at MainTest.main(test63.kt:10) test + +User code: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test63.MainTest", methodName = "main", fileName = "test63.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at MainTest.main(test64.kt:10) test + +User code: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test64.MainTest", methodName = "main", fileName = "test64.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at MainTest.main(test65.kt:10) test + +User code: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test65.MainTest", methodName = "main", fileName = "test65.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test66.kt:10) test + +User code: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test66.MainTest", methodName = "main", fileName = "test66.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at MainTest.main(test67.kt:10) test + +User code: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test67.MainTest", methodName = "main", fileName = "test67.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test68.kt:10) test + +User code: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test68.MainTest", methodName = "main", fileName = "test68.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test69.kt:10) test + +User code: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test69.MainTest", methodName = "main", fileName = "test69.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at MainTest.main(test70.kt:10) test + +User code: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test71.kt:10) test + +User code: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test72.kt:10) test + +User code: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at MainTest.main(test73.kt:10) test + +User code: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test73.MainTest", methodName = "main", fileName = "test73.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at MainTest.main(test74.kt:10) test + +User code: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test74.MainTest", methodName = "main", fileName = "test74.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test75.kt:10) test + +User code: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test75.MainTest", methodName = "main", fileName = "test75.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at MainTest.main(test76.kt:10) test + +User code: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test76.MainTest", methodName = "main", fileName = "test76.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at MainTest.main(test77.kt:10) test + +User code: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test77.MainTest", methodName = "main", fileName = "test77.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at MainTest.main(test78.kt:10) test + +User code: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test78.MainTest", methodName = "main", fileName = "test78.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test79.kt:10) test + +User code: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test79.MainTest", methodName = "main", fileName = "test79.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test80.kt:10) test + +User code: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test80.MainTest", methodName = "main", fileName = "test80.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test81.kt:10) test + +User code: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test81.MainTest", methodName = "main", fileName = "test81.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test82.kt:10) test + +User code: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test82.MainTest", methodName = "main", fileName = "test82.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test83.kt:10) test + +User code: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test83.MainTest", methodName = "main", fileName = "test83.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test84.kt:10) test + +User code: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test84.MainTest", methodName = "main", fileName = "test84.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test85.kt:10) test + +User code: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test85.MainTest", methodName = "main", fileName = "test85.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at MainTest.main(test86.kt:10) test + +User code: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test87.kt:10) test + +User code: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test88.kt:10) test + +User code: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}", throwable) at MainTest.main(test92.kt:10) test + +User code: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test92.MainTest", methodName = "main", fileName = "test92.kt", lineNumber = 10) + } + +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at MainTest.main(test93.kt:10) test + +User code: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test93.MainTest", methodName = "main", fileName = "test93.kt", lineNumber = 10) + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at MainTest.main(test94.kt:10) test + +User code: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test94.MainTest", methodName = "main", fileName = "test94.kt", lineNumber = 10) + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test95.kt:10) test + +User code: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test95.MainTest", methodName = "main", fileName = "test95.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at MainTest.main(test96.kt:10) test + +User code: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test96.MainTest", methodName = "main", fileName = "test96.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test97.kt:10) test + +User code: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test97.MainTest", methodName = "main", fileName = "test97.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test98.kt:10) test + +User code: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test98.MainTest", methodName = "main", fileName = "test98.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test99.kt:10) test + +User code: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test99.MainTest", methodName = "main", fileName = "test99.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test100.kt:10) test + +User code: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test100.MainTest", methodName = "main", fileName = "test100.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test101.kt:10) test + +User code: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test101.MainTest", methodName = "main", fileName = "test101.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at MainTest.main(test102.kt:10) test + +User code: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test103.kt:10) test + +User code: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test104.kt:10) test + +User code: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at MainTest.main(test105.kt:10) test + +User code: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test105.MainTest", methodName = "main", fileName = "test105.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at MainTest.main(test106.kt:10) test + +User code: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test106.MainTest", methodName = "main", fileName = "test106.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test107.kt:10) test + +User code: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test107.MainTest", methodName = "main", fileName = "test107.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at MainTest.main(test108.kt:10) test + +User code: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test108.MainTest", methodName = "main", fileName = "test108.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test112.kt:10) test + +User code: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test112.MainTest", methodName = "main", fileName = "test112.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test113.kt:10) test + +User code: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test113.MainTest", methodName = "main", fileName = "test113.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test114.kt:10) test + +User code: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test114.MainTest", methodName = "main", fileName = "test114.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test115.kt:10) test + +User code: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test115.MainTest", methodName = "main", fileName = "test115.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test116.kt:10) test + +User code: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test116.MainTest", methodName = "main", fileName = "test116.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test117.kt:10) test + +User code: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test117.MainTest", methodName = "main", fileName = "test117.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at MainTest.main(test118.kt:10) test + +User code: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test119.kt:10) test + +User code: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test120.kt:10) test + +User code: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}") at MainTest.main(test124.kt:10) test + +User code: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") + } + +} +``` + +Transformed into: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test124.MainTest", methodName = "main", fileName = "test124.kt", lineNumber = 10) + } + +} +``` + +
+ +### debug() { "debug messageBuilder" } at MainTest.main(test125.kt:10) test + +User code: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test125.MainTest", methodName = "main", fileName = "test125.kt", lineNumber = 10) + } + +} +``` + +### debug() { "debug messageBuilder $i" } at MainTest.main(test126.kt:10) test + +User code: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test126.MainTest", methodName = "main", fileName = "test126.kt", lineNumber = 10) + } + +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at MainTest.main(test127.kt:10) test + +User code: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test127.MainTest", methodName = "main", fileName = "test127.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at MainTest.main(test128.kt:10) test + +User code: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test128.MainTest", methodName = "main", fileName = "test128.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at MainTest.main(test129.kt:10) test + +User code: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test129.MainTest", methodName = "main", fileName = "test129.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test130.kt:10) test + +User code: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test130.MainTest", methodName = "main", fileName = "test130.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at MainTest.main(test131.kt:10) test + +User code: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test131.MainTest", methodName = "main", fileName = "test131.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test132.kt:10) test + +User code: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test132.MainTest", methodName = "main", fileName = "test132.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test133.kt:10) test + +User code: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test133.MainTest", methodName = "main", fileName = "test133.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at MainTest.main(test134.kt:10) test + +User code: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test135.kt:10) test + +User code: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test136.kt:10) test + +User code: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at MainTest.main(test137.kt:10) test + +User code: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test137.MainTest", methodName = "main", fileName = "test137.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at MainTest.main(test138.kt:10) test + +User code: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test138.MainTest", methodName = "main", fileName = "test138.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test139.kt:10) test + +User code: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test139.MainTest", methodName = "main", fileName = "test139.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at MainTest.main(test140.kt:10) test + +User code: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test140.MainTest", methodName = "main", fileName = "test140.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at MainTest.main(test141.kt:10) test + +User code: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test141.MainTest", methodName = "main", fileName = "test141.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at MainTest.main(test142.kt:10) test + +User code: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test142.MainTest", methodName = "main", fileName = "test142.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test143.kt:10) test + +User code: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test143.MainTest", methodName = "main", fileName = "test143.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test144.kt:10) test + +User code: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test144.MainTest", methodName = "main", fileName = "test144.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test145.kt:10) test + +User code: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test145.MainTest", methodName = "main", fileName = "test145.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test146.kt:10) test + +User code: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test146.MainTest", methodName = "main", fileName = "test146.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test147.kt:10) test + +User code: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test147.MainTest", methodName = "main", fileName = "test147.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test148.kt:10) test + +User code: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test148.MainTest", methodName = "main", fileName = "test148.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test149.kt:10) test + +User code: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test149.MainTest", methodName = "main", fileName = "test149.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at MainTest.main(test150.kt:10) test + +User code: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test151.kt:10) test + +User code: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test152.kt:10) test + +User code: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}", throwable) at MainTest.main(test156.kt:10) test + +User code: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test156.MainTest", methodName = "main", fileName = "test156.kt", lineNumber = 10) + } + +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at MainTest.main(test157.kt:10) test + +User code: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test157.MainTest", methodName = "main", fileName = "test157.kt", lineNumber = 10) + } + +} +``` + +### info(throwable) { "info messageBuilder $i" } at MainTest.main(test158.kt:10) test + +User code: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test158.MainTest", methodName = "main", fileName = "test158.kt", lineNumber = 10) + } + +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test159.kt:10) test + +User code: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test159.MainTest", methodName = "main", fileName = "test159.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at MainTest.main(test160.kt:10) test + +User code: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test160.MainTest", methodName = "main", fileName = "test160.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test161.kt:10) test + +User code: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test161.MainTest", methodName = "main", fileName = "test161.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test162.kt:10) test + +User code: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test162.MainTest", methodName = "main", fileName = "test162.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at MainTest.main(test163.kt:10) test + +User code: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test163.MainTest", methodName = "main", fileName = "test163.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test164.kt:10) test + +User code: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test164.MainTest", methodName = "main", fileName = "test164.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test165.kt:10) test + +User code: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test165.MainTest", methodName = "main", fileName = "test165.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at MainTest.main(test166.kt:10) test + +User code: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test167.kt:10) test + +User code: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test168.kt:10) test + +User code: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at MainTest.main(test169.kt:10) test + +User code: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test169.MainTest", methodName = "main", fileName = "test169.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at MainTest.main(test170.kt:10) test + +User code: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test170.MainTest", methodName = "main", fileName = "test170.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test171.kt:10) test + +User code: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test171.MainTest", methodName = "main", fileName = "test171.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at MainTest.main(test172.kt:10) test + +User code: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test172.MainTest", methodName = "main", fileName = "test172.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at MainTest.main(test176.kt:10) test + +User code: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test176.MainTest", methodName = "main", fileName = "test176.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test177.kt:10) test + +User code: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test177.MainTest", methodName = "main", fileName = "test177.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test178.kt:10) test + +User code: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test178.MainTest", methodName = "main", fileName = "test178.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at MainTest.main(test179.kt:10) test + +User code: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test179.MainTest", methodName = "main", fileName = "test179.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test180.kt:10) test + +User code: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test180.MainTest", methodName = "main", fileName = "test180.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test181.kt:10) test + +User code: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test181.MainTest", methodName = "main", fileName = "test181.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at MainTest.main(test182.kt:10) test + +User code: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test183.kt:10) test + +User code: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test184.kt:10) test + +User code: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}") at MainTest.main(test188.kt:10) test + +User code: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") + } + +} +``` + +Transformed into: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test188.MainTest", methodName = "main", fileName = "test188.kt", lineNumber = 10) + } + +} +``` + +
+ +### info() { "info messageBuilder" } at MainTest.main(test189.kt:10) test + +User code: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test189.MainTest", methodName = "main", fileName = "test189.kt", lineNumber = 10) + } + +} +``` + +### info() { "info messageBuilder $i" } at MainTest.main(test190.kt:10) test + +User code: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test190.MainTest", methodName = "main", fileName = "test190.kt", lineNumber = 10) + } + +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at MainTest.main(test191.kt:10) test + +User code: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test191.MainTest", methodName = "main", fileName = "test191.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=null } at MainTest.main(test192.kt:10) test + +User code: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test192.MainTest", methodName = "main", fileName = "test192.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at MainTest.main(test193.kt:10) test + +User code: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test193.MainTest", methodName = "main", fileName = "test193.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test194.kt:10) test + +User code: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test194.MainTest", methodName = "main", fileName = "test194.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at MainTest.main(test195.kt:10) test + +User code: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test195.MainTest", methodName = "main", fileName = "test195.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at MainTest.main(test196.kt:10) test + +User code: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test196.MainTest", methodName = "main", fileName = "test196.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test197.kt:10) test + +User code: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test197.MainTest", methodName = "main", fileName = "test197.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at MainTest.main(test198.kt:10) test + +User code: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test199.kt:10) test + +User code: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test200.kt:10) test + +User code: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at MainTest.main(test201.kt:10) test + +User code: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test201.MainTest", methodName = "main", fileName = "test201.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at MainTest.main(test202.kt:10) test + +User code: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test202.MainTest", methodName = "main", fileName = "test202.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test203.kt:10) test + +User code: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test203.MainTest", methodName = "main", fileName = "test203.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at MainTest.main(test204.kt:10) test + +User code: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test204.MainTest", methodName = "main", fileName = "test204.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at MainTest.main(test205.kt:10) test + +User code: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test205.MainTest", methodName = "main", fileName = "test205.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at MainTest.main(test206.kt:10) test + +User code: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test206.MainTest", methodName = "main", fileName = "test206.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test207.kt:10) test + +User code: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test207.MainTest", methodName = "main", fileName = "test207.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test208.kt:10) test + +User code: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test208.MainTest", methodName = "main", fileName = "test208.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test209.kt:10) test + +User code: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test209.MainTest", methodName = "main", fileName = "test209.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test210.kt:10) test + +User code: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test210.MainTest", methodName = "main", fileName = "test210.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test211.kt:10) test + +User code: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test211.MainTest", methodName = "main", fileName = "test211.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test212.kt:10) test + +User code: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test212.MainTest", methodName = "main", fileName = "test212.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test213.kt:10) test + +User code: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test213.MainTest", methodName = "main", fileName = "test213.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at MainTest.main(test214.kt:10) test + +User code: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test215.kt:10) test + +User code: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test216.kt:10) test + +User code: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}", throwable) at MainTest.main(test220.kt:10) test + +User code: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test220.MainTest", methodName = "main", fileName = "test220.kt", lineNumber = 10) + } + +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at MainTest.main(test221.kt:10) test + +User code: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test221.MainTest", methodName = "main", fileName = "test221.kt", lineNumber = 10) + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at MainTest.main(test222.kt:10) test + +User code: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test222.MainTest", methodName = "main", fileName = "test222.kt", lineNumber = 10) + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test223.kt:10) test + +User code: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test223.MainTest", methodName = "main", fileName = "test223.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at MainTest.main(test224.kt:10) test + +User code: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test224.MainTest", methodName = "main", fileName = "test224.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test225.kt:10) test + +User code: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test225.MainTest", methodName = "main", fileName = "test225.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test226.kt:10) test + +User code: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test226.MainTest", methodName = "main", fileName = "test226.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test227.kt:10) test + +User code: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test227.MainTest", methodName = "main", fileName = "test227.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test228.kt:10) test + +User code: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test228.MainTest", methodName = "main", fileName = "test228.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test229.kt:10) test + +User code: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test229.MainTest", methodName = "main", fileName = "test229.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at MainTest.main(test230.kt:10) test + +User code: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test231.kt:10) test + +User code: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test232.kt:10) test + +User code: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at MainTest.main(test233.kt:10) test + +User code: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test233.MainTest", methodName = "main", fileName = "test233.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at MainTest.main(test234.kt:10) test + +User code: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test234.MainTest", methodName = "main", fileName = "test234.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test235.kt:10) test + +User code: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test235.MainTest", methodName = "main", fileName = "test235.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at MainTest.main(test236.kt:10) test + +User code: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test236.MainTest", methodName = "main", fileName = "test236.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test240.kt:10) test + +User code: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test240.MainTest", methodName = "main", fileName = "test240.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test241.kt:10) test + +User code: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test241.MainTest", methodName = "main", fileName = "test241.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test242.kt:10) test + +User code: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test242.MainTest", methodName = "main", fileName = "test242.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test243.kt:10) test + +User code: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test243.MainTest", methodName = "main", fileName = "test243.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test244.kt:10) test + +User code: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test244.MainTest", methodName = "main", fileName = "test244.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test245.kt:10) test + +User code: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test245.MainTest", methodName = "main", fileName = "test245.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at MainTest.main(test246.kt:10) test + +User code: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test247.kt:10) test + +User code: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test248.kt:10) test + +User code: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}") at MainTest.main(test252.kt:10) test + +User code: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") + } + +} +``` + +Transformed into: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test252.MainTest", methodName = "main", fileName = "test252.kt", lineNumber = 10) + } + +} +``` + +
+ +### warn() { "warn messageBuilder" } at MainTest.main(test253.kt:10) test + +User code: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test253.MainTest", methodName = "main", fileName = "test253.kt", lineNumber = 10) + } + +} +``` + +### warn() { "warn messageBuilder $i" } at MainTest.main(test254.kt:10) test + +User code: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test254.MainTest", methodName = "main", fileName = "test254.kt", lineNumber = 10) + } + +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at MainTest.main(test255.kt:10) test + +User code: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test255.MainTest", methodName = "main", fileName = "test255.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at MainTest.main(test256.kt:10) test + +User code: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test256.MainTest", methodName = "main", fileName = "test256.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at MainTest.main(test257.kt:10) test + +User code: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test257.MainTest", methodName = "main", fileName = "test257.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test258.kt:10) test + +User code: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test258.MainTest", methodName = "main", fileName = "test258.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at MainTest.main(test259.kt:10) test + +User code: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test259.MainTest", methodName = "main", fileName = "test259.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test260.kt:10) test + +User code: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test260.MainTest", methodName = "main", fileName = "test260.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test261.kt:10) test + +User code: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test261.MainTest", methodName = "main", fileName = "test261.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at MainTest.main(test262.kt:10) test + +User code: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test263.kt:10) test + +User code: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test264.kt:10) test + +User code: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at MainTest.main(test265.kt:10) test + +User code: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test265.MainTest", methodName = "main", fileName = "test265.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at MainTest.main(test266.kt:10) test + +User code: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test266.MainTest", methodName = "main", fileName = "test266.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test267.kt:10) test + +User code: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test267.MainTest", methodName = "main", fileName = "test267.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at MainTest.main(test268.kt:10) test + +User code: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test268.MainTest", methodName = "main", fileName = "test268.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at MainTest.main(test269.kt:10) test + +User code: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test269.MainTest", methodName = "main", fileName = "test269.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at MainTest.main(test270.kt:10) test + +User code: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test270.MainTest", methodName = "main", fileName = "test270.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test271.kt:10) test + +User code: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test271.MainTest", methodName = "main", fileName = "test271.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test272.kt:10) test + +User code: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test272.MainTest", methodName = "main", fileName = "test272.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test273.kt:10) test + +User code: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test273.MainTest", methodName = "main", fileName = "test273.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test274.kt:10) test + +User code: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test274.MainTest", methodName = "main", fileName = "test274.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test275.kt:10) test + +User code: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test275.MainTest", methodName = "main", fileName = "test275.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test276.kt:10) test + +User code: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test276.MainTest", methodName = "main", fileName = "test276.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test277.kt:10) test + +User code: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test277.MainTest", methodName = "main", fileName = "test277.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at MainTest.main(test278.kt:10) test + +User code: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test279.kt:10) test + +User code: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test280.kt:10) test + +User code: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}", throwable) at MainTest.main(test284.kt:10) test + +User code: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test284.MainTest", methodName = "main", fileName = "test284.kt", lineNumber = 10) + } + +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at MainTest.main(test285.kt:10) test + +User code: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test285.MainTest", methodName = "main", fileName = "test285.kt", lineNumber = 10) + } + +} +``` + +### error(throwable) { "error messageBuilder $i" } at MainTest.main(test286.kt:10) test + +User code: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test286.MainTest", methodName = "main", fileName = "test286.kt", lineNumber = 10) + } + +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test287.kt:10) test + +User code: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test287.MainTest", methodName = "main", fileName = "test287.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=throwable } at MainTest.main(test288.kt:10) test + +User code: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test288.MainTest", methodName = "main", fileName = "test288.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test289.kt:10) test + +User code: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test289.MainTest", methodName = "main", fileName = "test289.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test290.kt:10) test + +User code: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test290.MainTest", methodName = "main", fileName = "test290.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at MainTest.main(test291.kt:10) test + +User code: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test291.MainTest", methodName = "main", fileName = "test291.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test292.kt:10) test + +User code: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test292.MainTest", methodName = "main", fileName = "test292.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test293.kt:10) test + +User code: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test293.MainTest", methodName = "main", fileName = "test293.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at MainTest.main(test294.kt:10) test + +User code: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test295.kt:10) test + +User code: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test296.kt:10) test + +User code: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at MainTest.main(test297.kt:10) test + +User code: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test297.MainTest", methodName = "main", fileName = "test297.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at MainTest.main(test298.kt:10) test + +User code: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test298.MainTest", methodName = "main", fileName = "test298.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test299.kt:10) test + +User code: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test299.MainTest", methodName = "main", fileName = "test299.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at MainTest.main(test300.kt:10) test + +User code: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test300.MainTest", methodName = "main", fileName = "test300.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at MainTest.main(test304.kt:10) test + +User code: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test304.MainTest", methodName = "main", fileName = "test304.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test305.kt:10) test + +User code: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test305.MainTest", methodName = "main", fileName = "test305.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test306.kt:10) test + +User code: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test306.MainTest", methodName = "main", fileName = "test306.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at MainTest.main(test307.kt:10) test + +User code: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test307.MainTest", methodName = "main", fileName = "test307.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test308.kt:10) test + +User code: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test308.MainTest", methodName = "main", fileName = "test308.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test309.kt:10) test + +User code: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test309.MainTest", methodName = "main", fileName = "test309.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at MainTest.main(test310.kt:10) test + +User code: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test311.kt:10) test + +User code: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test312.kt:10) test + +User code: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}") at MainTest.main(test316.kt:10) test + +User code: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") + } + +} +``` + +Transformed into: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test316.MainTest", methodName = "main", fileName = "test316.kt", lineNumber = 10) + } + +} +``` + +
+ +### error() { "error messageBuilder" } at MainTest.main(test317.kt:10) test + +User code: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test317.MainTest", methodName = "main", fileName = "test317.kt", lineNumber = 10) + } + +} +``` + +### error() { "error messageBuilder $i" } at MainTest.main(test318.kt:10) test + +User code: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test318.MainTest", methodName = "main", fileName = "test318.kt", lineNumber = 10) + } + +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at MainTest.main(test319.kt:10) test + +User code: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test319.MainTest", methodName = "main", fileName = "test319.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=null } at MainTest.main(test320.kt:10) test + +User code: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test320.MainTest", methodName = "main", fileName = "test320.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at MainTest.main(test321.kt:10) test + +User code: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test321.MainTest", methodName = "main", fileName = "test321.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test322.kt:10) test + +User code: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test322.MainTest", methodName = "main", fileName = "test322.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at MainTest.main(test323.kt:10) test + +User code: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test323.MainTest", methodName = "main", fileName = "test323.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at MainTest.main(test324.kt:10) test + +User code: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test324.MainTest", methodName = "main", fileName = "test324.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test325.kt:10) test + +User code: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test325.MainTest", methodName = "main", fileName = "test325.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
+ +
with class=false + +
entry/exit API + +### entry(argument1, argument2) at Test326Kt.main(test326.kt:10) test + +User code: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) +} +``` + +Transformed into: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entryWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "entry(argument1, argument2)", className = "test326.Test326Kt", methodName = "main", fileName = "test326.kt", lineNumber = 10)) +} +``` + +### exit(resultValue) at Test327Kt.main(test327.kt:10) test + +User code: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) +} +``` + +Transformed into: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "exit(resultValue)", className = "test327.Test327Kt", methodName = "main", fileName = "test327.kt", lineNumber = 10)) +} +``` + +### exit() at Test328Kt.main(test328.kt:10) test + +User code: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() +} +``` + +Transformed into: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(className = "test328.Test328Kt", methodName = "main", fileName = "test328.kt", lineNumber = 10)) +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at Test329Kt.main(test329.kt:10) test + +User code: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) +} +``` + +Transformed into: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "throwing(throwable)", className = "test329.Test329Kt", methodName = "main", fileName = "test329.kt", lineNumber = 10), throwable) +} +``` + +### catching(throwable) at Test330Kt.main(test330.kt:10) test + +User code: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) +} +``` + +Transformed into: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catchingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "catching(throwable)", className = "test330.Test330Kt", methodName = "main", fileName = "test330.kt", lineNumber = 10), throwable) +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at Test331Kt.main(test331.kt:10) test + +User code: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test332Kt.main(test332.kt:10) test + +User code: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test333Kt.main(test333.kt:10) test + +User code: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at Test334Kt.main(test334.kt:10) test + +User code: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test334.Test334Kt", methodName = "main", fileName = "test334.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at Test335Kt.main(test335.kt:10) test + +User code: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test335.Test335Kt", methodName = "main", fileName = "test335.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at Test336Kt.main(test336.kt:10) test + +User code: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test336.Test336Kt", methodName = "main", fileName = "test336.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at Test337Kt.main(test337.kt:10) test + +User code: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test337.Test337Kt", methodName = "main", fileName = "test337.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at Test338Kt.main(test338.kt:10) test + +User code: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test338.Test338Kt", methodName = "main", fileName = "test338.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at Test339Kt.main(test339.kt:10) test + +User code: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test339.Test339Kt", methodName = "main", fileName = "test339.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at Test340Kt.main(test340.kt:10) test + +User code: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test340.Test340Kt", methodName = "main", fileName = "test340.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at Test341Kt.main(test341.kt:10) test + +User code: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test341.Test341Kt", methodName = "main", fileName = "test341.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at Test342Kt.main(test342.kt:10) test + +User code: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test342.Test342Kt", methodName = "main", fileName = "test342.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test343Kt.main(test343.kt:10) test + +User code: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test343.Test343Kt", methodName = "main", fileName = "test343.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at Test344Kt.main(test344.kt:10) test + +User code: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test344.Test344Kt", methodName = "main", fileName = "test344.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at Test345Kt.main(test345.kt:10) test + +User code: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test345.Test345Kt", methodName = "main", fileName = "test345.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test346Kt.main(test346.kt:10) test + +User code: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test346.Test346Kt", methodName = "main", fileName = "test346.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at Test347Kt.main(test347.kt:10) test + +User code: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test348Kt.main(test348.kt:10) test + +User code: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test349Kt.main(test349.kt:10) test + +User code: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}", throwable) at Test353Kt.main(test353.kt:10) test + +User code: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test353.Test353Kt", methodName = "main", fileName = "test353.kt", lineNumber = 10) +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at Test354Kt.main(test354.kt:10) test + +User code: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test354.Test354Kt", methodName = "main", fileName = "test354.kt", lineNumber = 10) +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at Test355Kt.main(test355.kt:10) test + +User code: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test355.Test355Kt", methodName = "main", fileName = "test355.kt", lineNumber = 10) +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at Test356Kt.main(test356.kt:10) test + +User code: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test356.Test356Kt", methodName = "main", fileName = "test356.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at Test357Kt.main(test357.kt:10) test + +User code: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test357.Test357Kt", methodName = "main", fileName = "test357.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at Test358Kt.main(test358.kt:10) test + +User code: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test358.Test358Kt", methodName = "main", fileName = "test358.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test359Kt.main(test359.kt:10) test + +User code: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test359.Test359Kt", methodName = "main", fileName = "test359.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at Test360Kt.main(test360.kt:10) test + +User code: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test360.Test360Kt", methodName = "main", fileName = "test360.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at Test361Kt.main(test361.kt:10) test + +User code: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test361.Test361Kt", methodName = "main", fileName = "test361.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test362Kt.main(test362.kt:10) test + +User code: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test362.Test362Kt", methodName = "main", fileName = "test362.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at Test363Kt.main(test363.kt:10) test + +User code: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test364Kt.main(test364.kt:10) test + +User code: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test365Kt.main(test365.kt:10) test + +User code: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at Test366Kt.main(test366.kt:10) test + +User code: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test366.Test366Kt", methodName = "main", fileName = "test366.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at Test367Kt.main(test367.kt:10) test + +User code: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test367.Test367Kt", methodName = "main", fileName = "test367.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at Test368Kt.main(test368.kt:10) test + +User code: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test368.Test368Kt", methodName = "main", fileName = "test368.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at Test369Kt.main(test369.kt:10) test + +User code: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test369.Test369Kt", methodName = "main", fileName = "test369.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at Test373Kt.main(test373.kt:10) test + +User code: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test373.Test373Kt", methodName = "main", fileName = "test373.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at Test374Kt.main(test374.kt:10) test + +User code: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test374.Test374Kt", methodName = "main", fileName = "test374.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test375Kt.main(test375.kt:10) test + +User code: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test375.Test375Kt", methodName = "main", fileName = "test375.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at Test376Kt.main(test376.kt:10) test + +User code: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test376.Test376Kt", methodName = "main", fileName = "test376.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at Test377Kt.main(test377.kt:10) test + +User code: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test377.Test377Kt", methodName = "main", fileName = "test377.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test378Kt.main(test378.kt:10) test + +User code: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test378.Test378Kt", methodName = "main", fileName = "test378.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at Test379Kt.main(test379.kt:10) test + +User code: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test380Kt.main(test380.kt:10) test + +User code: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test381Kt.main(test381.kt:10) test + +User code: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}") at Test385Kt.main(test385.kt:10) test + +User code: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") +} +``` + +Transformed into: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test385.Test385Kt", methodName = "main", fileName = "test385.kt", lineNumber = 10) +} +``` + +
+ +### trace() { "trace messageBuilder" } at Test386Kt.main(test386.kt:10) test + +User code: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test386.Test386Kt", methodName = "main", fileName = "test386.kt", lineNumber = 10) +} +``` + +### trace() { "trace messageBuilder $i" } at Test387Kt.main(test387.kt:10) test + +User code: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test387.Test387Kt", methodName = "main", fileName = "test387.kt", lineNumber = 10) +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at Test388Kt.main(test388.kt:10) test + +User code: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test388.Test388Kt", methodName = "main", fileName = "test388.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at Test389Kt.main(test389.kt:10) test + +User code: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test389.Test389Kt", methodName = "main", fileName = "test389.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at Test390Kt.main(test390.kt:10) test + +User code: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test390.Test390Kt", methodName = "main", fileName = "test390.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at Test391Kt.main(test391.kt:10) test + +User code: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test391.Test391Kt", methodName = "main", fileName = "test391.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at Test392Kt.main(test392.kt:10) test + +User code: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test392.Test392Kt", methodName = "main", fileName = "test392.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at Test393Kt.main(test393.kt:10) test + +User code: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test393.Test393Kt", methodName = "main", fileName = "test393.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test394Kt.main(test394.kt:10) test + +User code: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test394.Test394Kt", methodName = "main", fileName = "test394.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at Test395Kt.main(test395.kt:10) test + +User code: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test396Kt.main(test396.kt:10) test + +User code: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test397Kt.main(test397.kt:10) test + +User code: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at Test398Kt.main(test398.kt:10) test + +User code: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test398.Test398Kt", methodName = "main", fileName = "test398.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at Test399Kt.main(test399.kt:10) test + +User code: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test399.Test399Kt", methodName = "main", fileName = "test399.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at Test400Kt.main(test400.kt:10) test + +User code: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test400.Test400Kt", methodName = "main", fileName = "test400.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at Test401Kt.main(test401.kt:10) test + +User code: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test401.Test401Kt", methodName = "main", fileName = "test401.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at Test402Kt.main(test402.kt:10) test + +User code: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test402.Test402Kt", methodName = "main", fileName = "test402.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at Test403Kt.main(test403.kt:10) test + +User code: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test403.Test403Kt", methodName = "main", fileName = "test403.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at Test404Kt.main(test404.kt:10) test + +User code: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test404.Test404Kt", methodName = "main", fileName = "test404.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at Test405Kt.main(test405.kt:10) test + +User code: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test405.Test405Kt", methodName = "main", fileName = "test405.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at Test406Kt.main(test406.kt:10) test + +User code: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test406.Test406Kt", methodName = "main", fileName = "test406.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test407Kt.main(test407.kt:10) test + +User code: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test407.Test407Kt", methodName = "main", fileName = "test407.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at Test408Kt.main(test408.kt:10) test + +User code: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test408.Test408Kt", methodName = "main", fileName = "test408.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at Test409Kt.main(test409.kt:10) test + +User code: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test409.Test409Kt", methodName = "main", fileName = "test409.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test410Kt.main(test410.kt:10) test + +User code: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test410.Test410Kt", methodName = "main", fileName = "test410.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at Test411Kt.main(test411.kt:10) test + +User code: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test412Kt.main(test412.kt:10) test + +User code: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test413Kt.main(test413.kt:10) test + +User code: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}", throwable) at Test417Kt.main(test417.kt:10) test + +User code: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test417.Test417Kt", methodName = "main", fileName = "test417.kt", lineNumber = 10) +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at Test418Kt.main(test418.kt:10) test + +User code: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test418.Test418Kt", methodName = "main", fileName = "test418.kt", lineNumber = 10) +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at Test419Kt.main(test419.kt:10) test + +User code: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test419.Test419Kt", methodName = "main", fileName = "test419.kt", lineNumber = 10) +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at Test420Kt.main(test420.kt:10) test + +User code: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test420.Test420Kt", methodName = "main", fileName = "test420.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at Test421Kt.main(test421.kt:10) test + +User code: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test421.Test421Kt", methodName = "main", fileName = "test421.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at Test422Kt.main(test422.kt:10) test + +User code: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test422.Test422Kt", methodName = "main", fileName = "test422.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test423Kt.main(test423.kt:10) test + +User code: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test423.Test423Kt", methodName = "main", fileName = "test423.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at Test424Kt.main(test424.kt:10) test + +User code: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test424.Test424Kt", methodName = "main", fileName = "test424.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at Test425Kt.main(test425.kt:10) test + +User code: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test425.Test425Kt", methodName = "main", fileName = "test425.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test426Kt.main(test426.kt:10) test + +User code: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test426.Test426Kt", methodName = "main", fileName = "test426.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at Test427Kt.main(test427.kt:10) test + +User code: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test428Kt.main(test428.kt:10) test + +User code: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test429Kt.main(test429.kt:10) test + +User code: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at Test430Kt.main(test430.kt:10) test + +User code: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test430.Test430Kt", methodName = "main", fileName = "test430.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at Test431Kt.main(test431.kt:10) test + +User code: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test431.Test431Kt", methodName = "main", fileName = "test431.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at Test432Kt.main(test432.kt:10) test + +User code: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test432.Test432Kt", methodName = "main", fileName = "test432.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at Test433Kt.main(test433.kt:10) test + +User code: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test433.Test433Kt", methodName = "main", fileName = "test433.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at Test437Kt.main(test437.kt:10) test + +User code: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test437.Test437Kt", methodName = "main", fileName = "test437.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at Test438Kt.main(test438.kt:10) test + +User code: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test438.Test438Kt", methodName = "main", fileName = "test438.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test439Kt.main(test439.kt:10) test + +User code: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test439.Test439Kt", methodName = "main", fileName = "test439.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at Test440Kt.main(test440.kt:10) test + +User code: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test440.Test440Kt", methodName = "main", fileName = "test440.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at Test441Kt.main(test441.kt:10) test + +User code: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test441.Test441Kt", methodName = "main", fileName = "test441.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test442Kt.main(test442.kt:10) test + +User code: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test442.Test442Kt", methodName = "main", fileName = "test442.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at Test443Kt.main(test443.kt:10) test + +User code: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test444Kt.main(test444.kt:10) test + +User code: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test445Kt.main(test445.kt:10) test + +User code: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}") at Test449Kt.main(test449.kt:10) test + +User code: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") +} +``` + +Transformed into: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test449.Test449Kt", methodName = "main", fileName = "test449.kt", lineNumber = 10) +} +``` + +
+ +### debug() { "debug messageBuilder" } at Test450Kt.main(test450.kt:10) test + +User code: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test450.Test450Kt", methodName = "main", fileName = "test450.kt", lineNumber = 10) +} +``` + +### debug() { "debug messageBuilder $i" } at Test451Kt.main(test451.kt:10) test + +User code: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test451.Test451Kt", methodName = "main", fileName = "test451.kt", lineNumber = 10) +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at Test452Kt.main(test452.kt:10) test + +User code: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test452.Test452Kt", methodName = "main", fileName = "test452.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at Test453Kt.main(test453.kt:10) test + +User code: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test453.Test453Kt", methodName = "main", fileName = "test453.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at Test454Kt.main(test454.kt:10) test + +User code: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test454.Test454Kt", methodName = "main", fileName = "test454.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at Test455Kt.main(test455.kt:10) test + +User code: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test455.Test455Kt", methodName = "main", fileName = "test455.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at Test456Kt.main(test456.kt:10) test + +User code: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test456.Test456Kt", methodName = "main", fileName = "test456.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at Test457Kt.main(test457.kt:10) test + +User code: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test457.Test457Kt", methodName = "main", fileName = "test457.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test458Kt.main(test458.kt:10) test + +User code: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test458.Test458Kt", methodName = "main", fileName = "test458.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at Test459Kt.main(test459.kt:10) test + +User code: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test460Kt.main(test460.kt:10) test + +User code: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test461Kt.main(test461.kt:10) test + +User code: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at Test462Kt.main(test462.kt:10) test + +User code: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test462.Test462Kt", methodName = "main", fileName = "test462.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at Test463Kt.main(test463.kt:10) test + +User code: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test463.Test463Kt", methodName = "main", fileName = "test463.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at Test464Kt.main(test464.kt:10) test + +User code: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test464.Test464Kt", methodName = "main", fileName = "test464.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at Test465Kt.main(test465.kt:10) test + +User code: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test465.Test465Kt", methodName = "main", fileName = "test465.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at Test466Kt.main(test466.kt:10) test + +User code: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test466.Test466Kt", methodName = "main", fileName = "test466.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at Test467Kt.main(test467.kt:10) test + +User code: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test467.Test467Kt", methodName = "main", fileName = "test467.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at Test468Kt.main(test468.kt:10) test + +User code: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test468.Test468Kt", methodName = "main", fileName = "test468.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at Test469Kt.main(test469.kt:10) test + +User code: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test469.Test469Kt", methodName = "main", fileName = "test469.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at Test470Kt.main(test470.kt:10) test + +User code: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test470.Test470Kt", methodName = "main", fileName = "test470.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test471Kt.main(test471.kt:10) test + +User code: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test471.Test471Kt", methodName = "main", fileName = "test471.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at Test472Kt.main(test472.kt:10) test + +User code: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test472.Test472Kt", methodName = "main", fileName = "test472.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at Test473Kt.main(test473.kt:10) test + +User code: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test473.Test473Kt", methodName = "main", fileName = "test473.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test474Kt.main(test474.kt:10) test + +User code: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test474.Test474Kt", methodName = "main", fileName = "test474.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at Test475Kt.main(test475.kt:10) test + +User code: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test476Kt.main(test476.kt:10) test + +User code: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test477Kt.main(test477.kt:10) test + +User code: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### info("info message {}", throwable) at Test481Kt.main(test481.kt:10) test + +User code: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test481.Test481Kt", methodName = "main", fileName = "test481.kt", lineNumber = 10) +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at Test482Kt.main(test482.kt:10) test + +User code: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test482.Test482Kt", methodName = "main", fileName = "test482.kt", lineNumber = 10) +} +``` + +### info(throwable) { "info messageBuilder $i" } at Test483Kt.main(test483.kt:10) test + +User code: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test483.Test483Kt", methodName = "main", fileName = "test483.kt", lineNumber = 10) +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at Test484Kt.main(test484.kt:10) test + +User code: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test484.Test484Kt", methodName = "main", fileName = "test484.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at Test485Kt.main(test485.kt:10) test + +User code: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test485.Test485Kt", methodName = "main", fileName = "test485.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at Test486Kt.main(test486.kt:10) test + +User code: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test486.Test486Kt", methodName = "main", fileName = "test486.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test487Kt.main(test487.kt:10) test + +User code: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test487.Test487Kt", methodName = "main", fileName = "test487.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at Test488Kt.main(test488.kt:10) test + +User code: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test488.Test488Kt", methodName = "main", fileName = "test488.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at Test489Kt.main(test489.kt:10) test + +User code: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test489.Test489Kt", methodName = "main", fileName = "test489.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test490Kt.main(test490.kt:10) test + +User code: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test490.Test490Kt", methodName = "main", fileName = "test490.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at Test491Kt.main(test491.kt:10) test + +User code: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test492Kt.main(test492.kt:10) test + +User code: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test493Kt.main(test493.kt:10) test + +User code: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at Test494Kt.main(test494.kt:10) test + +User code: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test494.Test494Kt", methodName = "main", fileName = "test494.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at Test495Kt.main(test495.kt:10) test + +User code: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test495.Test495Kt", methodName = "main", fileName = "test495.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at Test496Kt.main(test496.kt:10) test + +User code: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test496.Test496Kt", methodName = "main", fileName = "test496.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at Test497Kt.main(test497.kt:10) test + +User code: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test497.Test497Kt", methodName = "main", fileName = "test497.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at Test501Kt.main(test501.kt:10) test + +User code: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test501.Test501Kt", methodName = "main", fileName = "test501.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at Test502Kt.main(test502.kt:10) test + +User code: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test502.Test502Kt", methodName = "main", fileName = "test502.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test503Kt.main(test503.kt:10) test + +User code: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test503.Test503Kt", methodName = "main", fileName = "test503.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at Test504Kt.main(test504.kt:10) test + +User code: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test504.Test504Kt", methodName = "main", fileName = "test504.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at Test505Kt.main(test505.kt:10) test + +User code: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test505.Test505Kt", methodName = "main", fileName = "test505.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test506Kt.main(test506.kt:10) test + +User code: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test506.Test506Kt", methodName = "main", fileName = "test506.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at Test507Kt.main(test507.kt:10) test + +User code: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test508Kt.main(test508.kt:10) test + +User code: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test509Kt.main(test509.kt:10) test + +User code: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### info("info message {}") at Test513Kt.main(test513.kt:10) test + +User code: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") +} +``` + +Transformed into: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test513.Test513Kt", methodName = "main", fileName = "test513.kt", lineNumber = 10) +} +``` + +
+ +### info() { "info messageBuilder" } at Test514Kt.main(test514.kt:10) test + +User code: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test514.Test514Kt", methodName = "main", fileName = "test514.kt", lineNumber = 10) +} +``` + +### info() { "info messageBuilder $i" } at Test515Kt.main(test515.kt:10) test + +User code: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test515.Test515Kt", methodName = "main", fileName = "test515.kt", lineNumber = 10) +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at Test516Kt.main(test516.kt:10) test + +User code: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test516.Test516Kt", methodName = "main", fileName = "test516.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=null } at Test517Kt.main(test517.kt:10) test + +User code: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test517.Test517Kt", methodName = "main", fileName = "test517.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at Test518Kt.main(test518.kt:10) test + +User code: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test518.Test518Kt", methodName = "main", fileName = "test518.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at Test519Kt.main(test519.kt:10) test + +User code: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test519.Test519Kt", methodName = "main", fileName = "test519.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at Test520Kt.main(test520.kt:10) test + +User code: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test520.Test520Kt", methodName = "main", fileName = "test520.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at Test521Kt.main(test521.kt:10) test + +User code: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test521.Test521Kt", methodName = "main", fileName = "test521.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at Test522Kt.main(test522.kt:10) test + +User code: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test522.Test522Kt", methodName = "main", fileName = "test522.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at Test523Kt.main(test523.kt:10) test + +User code: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test524Kt.main(test524.kt:10) test + +User code: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test525Kt.main(test525.kt:10) test + +User code: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at Test526Kt.main(test526.kt:10) test + +User code: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test526.Test526Kt", methodName = "main", fileName = "test526.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at Test527Kt.main(test527.kt:10) test + +User code: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test527.Test527Kt", methodName = "main", fileName = "test527.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at Test528Kt.main(test528.kt:10) test + +User code: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test528.Test528Kt", methodName = "main", fileName = "test528.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at Test529Kt.main(test529.kt:10) test + +User code: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test529.Test529Kt", methodName = "main", fileName = "test529.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at Test530Kt.main(test530.kt:10) test + +User code: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test530.Test530Kt", methodName = "main", fileName = "test530.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at Test531Kt.main(test531.kt:10) test + +User code: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test531.Test531Kt", methodName = "main", fileName = "test531.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at Test532Kt.main(test532.kt:10) test + +User code: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test532.Test532Kt", methodName = "main", fileName = "test532.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at Test533Kt.main(test533.kt:10) test + +User code: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test533.Test533Kt", methodName = "main", fileName = "test533.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at Test534Kt.main(test534.kt:10) test + +User code: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test534.Test534Kt", methodName = "main", fileName = "test534.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test535Kt.main(test535.kt:10) test + +User code: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test535.Test535Kt", methodName = "main", fileName = "test535.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at Test536Kt.main(test536.kt:10) test + +User code: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test536.Test536Kt", methodName = "main", fileName = "test536.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at Test537Kt.main(test537.kt:10) test + +User code: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test537.Test537Kt", methodName = "main", fileName = "test537.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test538Kt.main(test538.kt:10) test + +User code: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test538.Test538Kt", methodName = "main", fileName = "test538.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at Test539Kt.main(test539.kt:10) test + +User code: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test540Kt.main(test540.kt:10) test + +User code: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test541Kt.main(test541.kt:10) test + +User code: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}", throwable) at Test545Kt.main(test545.kt:10) test + +User code: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test545.Test545Kt", methodName = "main", fileName = "test545.kt", lineNumber = 10) +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at Test546Kt.main(test546.kt:10) test + +User code: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test546.Test546Kt", methodName = "main", fileName = "test546.kt", lineNumber = 10) +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at Test547Kt.main(test547.kt:10) test + +User code: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test547.Test547Kt", methodName = "main", fileName = "test547.kt", lineNumber = 10) +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at Test548Kt.main(test548.kt:10) test + +User code: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test548.Test548Kt", methodName = "main", fileName = "test548.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at Test549Kt.main(test549.kt:10) test + +User code: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test549.Test549Kt", methodName = "main", fileName = "test549.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at Test550Kt.main(test550.kt:10) test + +User code: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test550.Test550Kt", methodName = "main", fileName = "test550.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test551Kt.main(test551.kt:10) test + +User code: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test551.Test551Kt", methodName = "main", fileName = "test551.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at Test552Kt.main(test552.kt:10) test + +User code: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test552.Test552Kt", methodName = "main", fileName = "test552.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at Test553Kt.main(test553.kt:10) test + +User code: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test553.Test553Kt", methodName = "main", fileName = "test553.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test554Kt.main(test554.kt:10) test + +User code: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test554.Test554Kt", methodName = "main", fileName = "test554.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at Test555Kt.main(test555.kt:10) test + +User code: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test556Kt.main(test556.kt:10) test + +User code: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test557Kt.main(test557.kt:10) test + +User code: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at Test558Kt.main(test558.kt:10) test + +User code: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test558.Test558Kt", methodName = "main", fileName = "test558.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at Test559Kt.main(test559.kt:10) test + +User code: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test559.Test559Kt", methodName = "main", fileName = "test559.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at Test560Kt.main(test560.kt:10) test + +User code: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test560.Test560Kt", methodName = "main", fileName = "test560.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at Test561Kt.main(test561.kt:10) test + +User code: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test561.Test561Kt", methodName = "main", fileName = "test561.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at Test565Kt.main(test565.kt:10) test + +User code: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test565.Test565Kt", methodName = "main", fileName = "test565.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at Test566Kt.main(test566.kt:10) test + +User code: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test566.Test566Kt", methodName = "main", fileName = "test566.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test567Kt.main(test567.kt:10) test + +User code: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test567.Test567Kt", methodName = "main", fileName = "test567.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at Test568Kt.main(test568.kt:10) test + +User code: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test568.Test568Kt", methodName = "main", fileName = "test568.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at Test569Kt.main(test569.kt:10) test + +User code: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test569.Test569Kt", methodName = "main", fileName = "test569.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test570Kt.main(test570.kt:10) test + +User code: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test570.Test570Kt", methodName = "main", fileName = "test570.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at Test571Kt.main(test571.kt:10) test + +User code: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test572Kt.main(test572.kt:10) test + +User code: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test573Kt.main(test573.kt:10) test + +User code: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}") at Test577Kt.main(test577.kt:10) test + +User code: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") +} +``` + +Transformed into: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test577.Test577Kt", methodName = "main", fileName = "test577.kt", lineNumber = 10) +} +``` + +
+ +### warn() { "warn messageBuilder" } at Test578Kt.main(test578.kt:10) test + +User code: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test578.Test578Kt", methodName = "main", fileName = "test578.kt", lineNumber = 10) +} +``` + +### warn() { "warn messageBuilder $i" } at Test579Kt.main(test579.kt:10) test + +User code: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test579.Test579Kt", methodName = "main", fileName = "test579.kt", lineNumber = 10) +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at Test580Kt.main(test580.kt:10) test + +User code: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test580.Test580Kt", methodName = "main", fileName = "test580.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at Test581Kt.main(test581.kt:10) test + +User code: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test581.Test581Kt", methodName = "main", fileName = "test581.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at Test582Kt.main(test582.kt:10) test + +User code: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test582.Test582Kt", methodName = "main", fileName = "test582.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at Test583Kt.main(test583.kt:10) test + +User code: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test583.Test583Kt", methodName = "main", fileName = "test583.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at Test584Kt.main(test584.kt:10) test + +User code: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test584.Test584Kt", methodName = "main", fileName = "test584.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at Test585Kt.main(test585.kt:10) test + +User code: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test585.Test585Kt", methodName = "main", fileName = "test585.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test586Kt.main(test586.kt:10) test + +User code: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test586.Test586Kt", methodName = "main", fileName = "test586.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at Test587Kt.main(test587.kt:10) test + +User code: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test588Kt.main(test588.kt:10) test + +User code: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test589Kt.main(test589.kt:10) test + +User code: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at Test590Kt.main(test590.kt:10) test + +User code: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test590.Test590Kt", methodName = "main", fileName = "test590.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at Test591Kt.main(test591.kt:10) test + +User code: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test591.Test591Kt", methodName = "main", fileName = "test591.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at Test592Kt.main(test592.kt:10) test + +User code: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test592.Test592Kt", methodName = "main", fileName = "test592.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at Test593Kt.main(test593.kt:10) test + +User code: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test593.Test593Kt", methodName = "main", fileName = "test593.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at Test594Kt.main(test594.kt:10) test + +User code: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test594.Test594Kt", methodName = "main", fileName = "test594.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at Test595Kt.main(test595.kt:10) test + +User code: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test595.Test595Kt", methodName = "main", fileName = "test595.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at Test596Kt.main(test596.kt:10) test + +User code: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test596.Test596Kt", methodName = "main", fileName = "test596.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at Test597Kt.main(test597.kt:10) test + +User code: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test597.Test597Kt", methodName = "main", fileName = "test597.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at Test598Kt.main(test598.kt:10) test + +User code: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test598.Test598Kt", methodName = "main", fileName = "test598.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test599Kt.main(test599.kt:10) test + +User code: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test599.Test599Kt", methodName = "main", fileName = "test599.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at Test600Kt.main(test600.kt:10) test + +User code: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test600.Test600Kt", methodName = "main", fileName = "test600.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at Test601Kt.main(test601.kt:10) test + +User code: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test601.Test601Kt", methodName = "main", fileName = "test601.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test602Kt.main(test602.kt:10) test + +User code: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test602.Test602Kt", methodName = "main", fileName = "test602.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at Test603Kt.main(test603.kt:10) test + +User code: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test604Kt.main(test604.kt:10) test + +User code: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test605Kt.main(test605.kt:10) test + +User code: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### error("error message {}", throwable) at Test609Kt.main(test609.kt:10) test + +User code: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test609.Test609Kt", methodName = "main", fileName = "test609.kt", lineNumber = 10) +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at Test610Kt.main(test610.kt:10) test + +User code: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test610.Test610Kt", methodName = "main", fileName = "test610.kt", lineNumber = 10) +} +``` + +### error(throwable) { "error messageBuilder $i" } at Test611Kt.main(test611.kt:10) test + +User code: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test611.Test611Kt", methodName = "main", fileName = "test611.kt", lineNumber = 10) +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at Test612Kt.main(test612.kt:10) test + +User code: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test612.Test612Kt", methodName = "main", fileName = "test612.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=throwable } at Test613Kt.main(test613.kt:10) test + +User code: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test613.Test613Kt", methodName = "main", fileName = "test613.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at Test614Kt.main(test614.kt:10) test + +User code: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test614.Test614Kt", methodName = "main", fileName = "test614.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test615Kt.main(test615.kt:10) test + +User code: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test615.Test615Kt", methodName = "main", fileName = "test615.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at Test616Kt.main(test616.kt:10) test + +User code: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test616.Test616Kt", methodName = "main", fileName = "test616.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at Test617Kt.main(test617.kt:10) test + +User code: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test617.Test617Kt", methodName = "main", fileName = "test617.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test618Kt.main(test618.kt:10) test + +User code: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test618.Test618Kt", methodName = "main", fileName = "test618.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at Test619Kt.main(test619.kt:10) test + +User code: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test620Kt.main(test620.kt:10) test + +User code: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test621Kt.main(test621.kt:10) test + +User code: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at Test622Kt.main(test622.kt:10) test + +User code: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test622.Test622Kt", methodName = "main", fileName = "test622.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at Test623Kt.main(test623.kt:10) test + +User code: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test623.Test623Kt", methodName = "main", fileName = "test623.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at Test624Kt.main(test624.kt:10) test + +User code: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test624.Test624Kt", methodName = "main", fileName = "test624.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at Test625Kt.main(test625.kt:10) test + +User code: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test625.Test625Kt", methodName = "main", fileName = "test625.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at Test629Kt.main(test629.kt:10) test + +User code: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test629.Test629Kt", methodName = "main", fileName = "test629.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at Test630Kt.main(test630.kt:10) test + +User code: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test630.Test630Kt", methodName = "main", fileName = "test630.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test631Kt.main(test631.kt:10) test + +User code: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test631.Test631Kt", methodName = "main", fileName = "test631.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at Test632Kt.main(test632.kt:10) test + +User code: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test632.Test632Kt", methodName = "main", fileName = "test632.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at Test633Kt.main(test633.kt:10) test + +User code: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test633.Test633Kt", methodName = "main", fileName = "test633.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test634Kt.main(test634.kt:10) test + +User code: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test634.Test634Kt", methodName = "main", fileName = "test634.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at Test635Kt.main(test635.kt:10) test + +User code: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test636Kt.main(test636.kt:10) test + +User code: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test637Kt.main(test637.kt:10) test + +User code: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### error("error message {}") at Test641Kt.main(test641.kt:10) test + +User code: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") +} +``` + +Transformed into: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test641.Test641Kt", methodName = "main", fileName = "test641.kt", lineNumber = 10) +} +``` + +
+ +### error() { "error messageBuilder" } at Test642Kt.main(test642.kt:10) test + +User code: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test642.Test642Kt", methodName = "main", fileName = "test642.kt", lineNumber = 10) +} +``` + +### error() { "error messageBuilder $i" } at Test643Kt.main(test643.kt:10) test + +User code: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test643.Test643Kt", methodName = "main", fileName = "test643.kt", lineNumber = 10) +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at Test644Kt.main(test644.kt:10) test + +User code: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test644.Test644Kt", methodName = "main", fileName = "test644.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=null } at Test645Kt.main(test645.kt:10) test + +User code: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test645.Test645Kt", methodName = "main", fileName = "test645.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at Test646Kt.main(test646.kt:10) test + +User code: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test646.Test646Kt", methodName = "main", fileName = "test646.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at Test647Kt.main(test647.kt:10) test + +User code: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test647.Test647Kt", methodName = "main", fileName = "test647.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at Test648Kt.main(test648.kt:10) test + +User code: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test648.Test648Kt", methodName = "main", fileName = "test648.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at Test649Kt.main(test649.kt:10) test + +User code: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test649.Test649Kt", methodName = "main", fileName = "test649.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at Test650Kt.main(test650.kt:10) test + +User code: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test650.Test650Kt", methodName = "main", fileName = "test650.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
+ +
featureFlag=DISABLE_TRANSFORMING_DEPRECATED_API + +
with class=true + +
entry/exit API + +### entry(argument1, argument2) at MainTest.main(test1.kt:10) test + +User code: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) + } + +} +``` + +Transformed into: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entryWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "entry(argument1, argument2)", className = "test1.MainTest", methodName = "main", fileName = "test1.kt", lineNumber = 10)) + } + +} +``` + +### exit(resultValue) at MainTest.main(test2.kt:10) test + +User code: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) + } + +} +``` + +Transformed into: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "exit(resultValue)", className = "test2.MainTest", methodName = "main", fileName = "test2.kt", lineNumber = 10)) + } + +} +``` + +### exit() at MainTest.main(test3.kt:10) test + +User code: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() + } + +} +``` + +Transformed into: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(className = "test3.MainTest", methodName = "main", fileName = "test3.kt", lineNumber = 10)) + } + +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at MainTest.main(test4.kt:10) test + +User code: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) + } + +} +``` + +Transformed into: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "throwing(throwable)", className = "test4.MainTest", methodName = "main", fileName = "test4.kt", lineNumber = 10), throwable) + } + +} +``` + +### catching(throwable) at MainTest.main(test5.kt:10) test + +User code: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) + } + +} +``` + +Transformed into: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catchingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "catching(throwable)", className = "test5.MainTest", methodName = "main", fileName = "test5.kt", lineNumber = 10), throwable) + } + +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at MainTest.main(test6.kt:10) test + +User code: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test7.kt:10) test + +User code: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test8.kt:10) test + +User code: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at MainTest.main(test9.kt:10) test + +User code: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at MainTest.main(test10.kt:10) test + +User code: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test11.kt:10) test + +User code: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at MainTest.main(test12.kt:10) test + +User code: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at MainTest.main(test13.kt:10) test + +User code: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test13.MainTest", methodName = "main", fileName = "test13.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at MainTest.main(test14.kt:10) test + +User code: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test14.MainTest", methodName = "main", fileName = "test14.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test15.kt:10) test + +User code: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test15.MainTest", methodName = "main", fileName = "test15.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test16.kt:10) test + +User code: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test16.MainTest", methodName = "main", fileName = "test16.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test17.kt:10) test + +User code: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test17.MainTest", methodName = "main", fileName = "test17.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test18.kt:10) test + +User code: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test18.MainTest", methodName = "main", fileName = "test18.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test19.kt:10) test + +User code: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test19.MainTest", methodName = "main", fileName = "test19.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test20.kt:10) test + +User code: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test20.MainTest", methodName = "main", fileName = "test20.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test21.kt:10) test + +User code: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test21.MainTest", methodName = "main", fileName = "test21.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at MainTest.main(test22.kt:10) test + +User code: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test23.kt:10) test + +User code: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test24.kt:10) test + +User code: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}", throwable) at MainTest.main(test28.kt:10) test + +User code: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) + } + +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at MainTest.main(test29.kt:10) test + +User code: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test29.MainTest", methodName = "main", fileName = "test29.kt", lineNumber = 10) + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at MainTest.main(test30.kt:10) test + +User code: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test30.MainTest", methodName = "main", fileName = "test30.kt", lineNumber = 10) + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test31.kt:10) test + +User code: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test31.MainTest", methodName = "main", fileName = "test31.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at MainTest.main(test32.kt:10) test + +User code: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test32.MainTest", methodName = "main", fileName = "test32.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test33.kt:10) test + +User code: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test33.MainTest", methodName = "main", fileName = "test33.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test34.kt:10) test + +User code: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test34.MainTest", methodName = "main", fileName = "test34.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test35.kt:10) test + +User code: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test35.MainTest", methodName = "main", fileName = "test35.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test36.kt:10) test + +User code: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test36.MainTest", methodName = "main", fileName = "test36.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test37.kt:10) test + +User code: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test37.MainTest", methodName = "main", fileName = "test37.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at MainTest.main(test38.kt:10) test + +User code: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test39.kt:10) test + +User code: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test40.kt:10) test + +User code: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at MainTest.main(test41.kt:10) test + +User code: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at MainTest.main(test42.kt:10) test + +User code: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test43.kt:10) test + +User code: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at MainTest.main(test44.kt:10) test + +User code: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test48.kt:10) test + +User code: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test48.MainTest", methodName = "main", fileName = "test48.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test49.kt:10) test + +User code: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test49.MainTest", methodName = "main", fileName = "test49.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test50.kt:10) test + +User code: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test50.MainTest", methodName = "main", fileName = "test50.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test51.kt:10) test + +User code: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test51.MainTest", methodName = "main", fileName = "test51.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test52.kt:10) test + +User code: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test52.MainTest", methodName = "main", fileName = "test52.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test53.kt:10) test + +User code: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test53.MainTest", methodName = "main", fileName = "test53.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at MainTest.main(test54.kt:10) test + +User code: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test55.kt:10) test + +User code: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test56.kt:10) test + +User code: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}") at MainTest.main(test60.kt:10) test + +User code: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") + } + +} +``` + +Remains as-is: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") + } + +} +``` + +
+ +### trace() { "trace messageBuilder" } at MainTest.main(test61.kt:10) test + +User code: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test61.MainTest", methodName = "main", fileName = "test61.kt", lineNumber = 10) + } + +} +``` + +### trace() { "trace messageBuilder $i" } at MainTest.main(test62.kt:10) test + +User code: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test62.MainTest", methodName = "main", fileName = "test62.kt", lineNumber = 10) + } + +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at MainTest.main(test63.kt:10) test + +User code: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test63.MainTest", methodName = "main", fileName = "test63.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at MainTest.main(test64.kt:10) test + +User code: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test64.MainTest", methodName = "main", fileName = "test64.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at MainTest.main(test65.kt:10) test + +User code: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test65.MainTest", methodName = "main", fileName = "test65.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test66.kt:10) test + +User code: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test66.MainTest", methodName = "main", fileName = "test66.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at MainTest.main(test67.kt:10) test + +User code: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test67.MainTest", methodName = "main", fileName = "test67.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test68.kt:10) test + +User code: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test68.MainTest", methodName = "main", fileName = "test68.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test69.kt:10) test + +User code: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test69.MainTest", methodName = "main", fileName = "test69.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at MainTest.main(test70.kt:10) test + +User code: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test71.kt:10) test + +User code: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test72.kt:10) test + +User code: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at MainTest.main(test73.kt:10) test + +User code: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at MainTest.main(test74.kt:10) test + +User code: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test75.kt:10) test + +User code: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at MainTest.main(test76.kt:10) test + +User code: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at MainTest.main(test77.kt:10) test + +User code: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test77.MainTest", methodName = "main", fileName = "test77.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at MainTest.main(test78.kt:10) test + +User code: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test78.MainTest", methodName = "main", fileName = "test78.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test79.kt:10) test + +User code: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test79.MainTest", methodName = "main", fileName = "test79.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test80.kt:10) test + +User code: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test80.MainTest", methodName = "main", fileName = "test80.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test81.kt:10) test + +User code: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test81.MainTest", methodName = "main", fileName = "test81.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test82.kt:10) test + +User code: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test82.MainTest", methodName = "main", fileName = "test82.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test83.kt:10) test + +User code: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test83.MainTest", methodName = "main", fileName = "test83.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test84.kt:10) test + +User code: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test84.MainTest", methodName = "main", fileName = "test84.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test85.kt:10) test + +User code: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test85.MainTest", methodName = "main", fileName = "test85.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at MainTest.main(test86.kt:10) test + +User code: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test87.kt:10) test + +User code: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test88.kt:10) test + +User code: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}", throwable) at MainTest.main(test92.kt:10) test + +User code: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) + } + +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at MainTest.main(test93.kt:10) test + +User code: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test93.MainTest", methodName = "main", fileName = "test93.kt", lineNumber = 10) + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at MainTest.main(test94.kt:10) test + +User code: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test94.MainTest", methodName = "main", fileName = "test94.kt", lineNumber = 10) + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test95.kt:10) test + +User code: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test95.MainTest", methodName = "main", fileName = "test95.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at MainTest.main(test96.kt:10) test + +User code: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test96.MainTest", methodName = "main", fileName = "test96.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test97.kt:10) test + +User code: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test97.MainTest", methodName = "main", fileName = "test97.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test98.kt:10) test + +User code: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test98.MainTest", methodName = "main", fileName = "test98.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test99.kt:10) test + +User code: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test99.MainTest", methodName = "main", fileName = "test99.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test100.kt:10) test + +User code: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test100.MainTest", methodName = "main", fileName = "test100.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test101.kt:10) test + +User code: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test101.MainTest", methodName = "main", fileName = "test101.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at MainTest.main(test102.kt:10) test + +User code: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test103.kt:10) test + +User code: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test104.kt:10) test + +User code: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at MainTest.main(test105.kt:10) test + +User code: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at MainTest.main(test106.kt:10) test + +User code: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test107.kt:10) test + +User code: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at MainTest.main(test108.kt:10) test + +User code: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test112.kt:10) test + +User code: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test112.MainTest", methodName = "main", fileName = "test112.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test113.kt:10) test + +User code: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test113.MainTest", methodName = "main", fileName = "test113.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test114.kt:10) test + +User code: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test114.MainTest", methodName = "main", fileName = "test114.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test115.kt:10) test + +User code: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test115.MainTest", methodName = "main", fileName = "test115.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test116.kt:10) test + +User code: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test116.MainTest", methodName = "main", fileName = "test116.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test117.kt:10) test + +User code: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test117.MainTest", methodName = "main", fileName = "test117.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at MainTest.main(test118.kt:10) test + +User code: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test119.kt:10) test + +User code: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test120.kt:10) test + +User code: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}") at MainTest.main(test124.kt:10) test + +User code: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") + } + +} +``` + +Remains as-is: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") + } + +} +``` + +
+ +### debug() { "debug messageBuilder" } at MainTest.main(test125.kt:10) test + +User code: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test125.MainTest", methodName = "main", fileName = "test125.kt", lineNumber = 10) + } + +} +``` + +### debug() { "debug messageBuilder $i" } at MainTest.main(test126.kt:10) test + +User code: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test126.MainTest", methodName = "main", fileName = "test126.kt", lineNumber = 10) + } + +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at MainTest.main(test127.kt:10) test + +User code: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test127.MainTest", methodName = "main", fileName = "test127.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at MainTest.main(test128.kt:10) test + +User code: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test128.MainTest", methodName = "main", fileName = "test128.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at MainTest.main(test129.kt:10) test + +User code: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test129.MainTest", methodName = "main", fileName = "test129.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test130.kt:10) test + +User code: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test130.MainTest", methodName = "main", fileName = "test130.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at MainTest.main(test131.kt:10) test + +User code: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test131.MainTest", methodName = "main", fileName = "test131.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test132.kt:10) test + +User code: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test132.MainTest", methodName = "main", fileName = "test132.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test133.kt:10) test + +User code: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test133.MainTest", methodName = "main", fileName = "test133.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at MainTest.main(test134.kt:10) test + +User code: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test135.kt:10) test + +User code: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test136.kt:10) test + +User code: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at MainTest.main(test137.kt:10) test + +User code: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at MainTest.main(test138.kt:10) test + +User code: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test139.kt:10) test + +User code: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at MainTest.main(test140.kt:10) test + +User code: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at MainTest.main(test141.kt:10) test + +User code: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test141.MainTest", methodName = "main", fileName = "test141.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at MainTest.main(test142.kt:10) test + +User code: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test142.MainTest", methodName = "main", fileName = "test142.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test143.kt:10) test + +User code: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test143.MainTest", methodName = "main", fileName = "test143.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test144.kt:10) test + +User code: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test144.MainTest", methodName = "main", fileName = "test144.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test145.kt:10) test + +User code: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test145.MainTest", methodName = "main", fileName = "test145.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test146.kt:10) test + +User code: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test146.MainTest", methodName = "main", fileName = "test146.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test147.kt:10) test + +User code: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test147.MainTest", methodName = "main", fileName = "test147.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test148.kt:10) test + +User code: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test148.MainTest", methodName = "main", fileName = "test148.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test149.kt:10) test + +User code: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test149.MainTest", methodName = "main", fileName = "test149.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at MainTest.main(test150.kt:10) test + +User code: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test151.kt:10) test + +User code: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test152.kt:10) test + +User code: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}", throwable) at MainTest.main(test156.kt:10) test + +User code: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) + } + +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at MainTest.main(test157.kt:10) test + +User code: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test157.MainTest", methodName = "main", fileName = "test157.kt", lineNumber = 10) + } + +} +``` + +### info(throwable) { "info messageBuilder $i" } at MainTest.main(test158.kt:10) test + +User code: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test158.MainTest", methodName = "main", fileName = "test158.kt", lineNumber = 10) + } + +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test159.kt:10) test + +User code: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test159.MainTest", methodName = "main", fileName = "test159.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at MainTest.main(test160.kt:10) test + +User code: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test160.MainTest", methodName = "main", fileName = "test160.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test161.kt:10) test + +User code: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test161.MainTest", methodName = "main", fileName = "test161.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test162.kt:10) test + +User code: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test162.MainTest", methodName = "main", fileName = "test162.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at MainTest.main(test163.kt:10) test + +User code: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test163.MainTest", methodName = "main", fileName = "test163.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test164.kt:10) test + +User code: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test164.MainTest", methodName = "main", fileName = "test164.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test165.kt:10) test + +User code: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test165.MainTest", methodName = "main", fileName = "test165.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at MainTest.main(test166.kt:10) test + +User code: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test167.kt:10) test + +User code: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test168.kt:10) test + +User code: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at MainTest.main(test169.kt:10) test + +User code: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at MainTest.main(test170.kt:10) test + +User code: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test171.kt:10) test + +User code: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at MainTest.main(test172.kt:10) test + +User code: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at MainTest.main(test176.kt:10) test + +User code: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test176.MainTest", methodName = "main", fileName = "test176.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test177.kt:10) test + +User code: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test177.MainTest", methodName = "main", fileName = "test177.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test178.kt:10) test + +User code: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test178.MainTest", methodName = "main", fileName = "test178.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at MainTest.main(test179.kt:10) test + +User code: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test179.MainTest", methodName = "main", fileName = "test179.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test180.kt:10) test + +User code: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test180.MainTest", methodName = "main", fileName = "test180.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test181.kt:10) test + +User code: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test181.MainTest", methodName = "main", fileName = "test181.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at MainTest.main(test182.kt:10) test + +User code: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test183.kt:10) test + +User code: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test184.kt:10) test + +User code: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}") at MainTest.main(test188.kt:10) test + +User code: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") + } + +} +``` + +Remains as-is: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") + } + +} +``` + +
+ +### info() { "info messageBuilder" } at MainTest.main(test189.kt:10) test + +User code: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test189.MainTest", methodName = "main", fileName = "test189.kt", lineNumber = 10) + } + +} +``` + +### info() { "info messageBuilder $i" } at MainTest.main(test190.kt:10) test + +User code: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test190.MainTest", methodName = "main", fileName = "test190.kt", lineNumber = 10) + } + +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at MainTest.main(test191.kt:10) test + +User code: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test191.MainTest", methodName = "main", fileName = "test191.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=null } at MainTest.main(test192.kt:10) test + +User code: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test192.MainTest", methodName = "main", fileName = "test192.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at MainTest.main(test193.kt:10) test + +User code: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test193.MainTest", methodName = "main", fileName = "test193.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test194.kt:10) test + +User code: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test194.MainTest", methodName = "main", fileName = "test194.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at MainTest.main(test195.kt:10) test + +User code: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test195.MainTest", methodName = "main", fileName = "test195.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at MainTest.main(test196.kt:10) test + +User code: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test196.MainTest", methodName = "main", fileName = "test196.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test197.kt:10) test + +User code: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test197.MainTest", methodName = "main", fileName = "test197.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at MainTest.main(test198.kt:10) test + +User code: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test199.kt:10) test + +User code: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test200.kt:10) test + +User code: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at MainTest.main(test201.kt:10) test + +User code: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at MainTest.main(test202.kt:10) test + +User code: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test203.kt:10) test + +User code: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at MainTest.main(test204.kt:10) test + +User code: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at MainTest.main(test205.kt:10) test + +User code: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test205.MainTest", methodName = "main", fileName = "test205.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at MainTest.main(test206.kt:10) test + +User code: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test206.MainTest", methodName = "main", fileName = "test206.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test207.kt:10) test + +User code: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test207.MainTest", methodName = "main", fileName = "test207.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test208.kt:10) test + +User code: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test208.MainTest", methodName = "main", fileName = "test208.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test209.kt:10) test + +User code: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test209.MainTest", methodName = "main", fileName = "test209.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test210.kt:10) test + +User code: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test210.MainTest", methodName = "main", fileName = "test210.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test211.kt:10) test + +User code: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test211.MainTest", methodName = "main", fileName = "test211.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test212.kt:10) test + +User code: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test212.MainTest", methodName = "main", fileName = "test212.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test213.kt:10) test + +User code: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test213.MainTest", methodName = "main", fileName = "test213.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at MainTest.main(test214.kt:10) test + +User code: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test215.kt:10) test + +User code: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test216.kt:10) test + +User code: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}", throwable) at MainTest.main(test220.kt:10) test + +User code: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) + } + +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at MainTest.main(test221.kt:10) test + +User code: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test221.MainTest", methodName = "main", fileName = "test221.kt", lineNumber = 10) + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at MainTest.main(test222.kt:10) test + +User code: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test222.MainTest", methodName = "main", fileName = "test222.kt", lineNumber = 10) + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test223.kt:10) test + +User code: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test223.MainTest", methodName = "main", fileName = "test223.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at MainTest.main(test224.kt:10) test + +User code: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test224.MainTest", methodName = "main", fileName = "test224.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test225.kt:10) test + +User code: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test225.MainTest", methodName = "main", fileName = "test225.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test226.kt:10) test + +User code: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test226.MainTest", methodName = "main", fileName = "test226.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test227.kt:10) test + +User code: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test227.MainTest", methodName = "main", fileName = "test227.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test228.kt:10) test + +User code: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test228.MainTest", methodName = "main", fileName = "test228.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test229.kt:10) test + +User code: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test229.MainTest", methodName = "main", fileName = "test229.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at MainTest.main(test230.kt:10) test + +User code: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test231.kt:10) test + +User code: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test232.kt:10) test + +User code: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at MainTest.main(test233.kt:10) test + +User code: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at MainTest.main(test234.kt:10) test + +User code: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test235.kt:10) test + +User code: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at MainTest.main(test236.kt:10) test + +User code: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test240.kt:10) test + +User code: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test240.MainTest", methodName = "main", fileName = "test240.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test241.kt:10) test + +User code: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test241.MainTest", methodName = "main", fileName = "test241.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test242.kt:10) test + +User code: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test242.MainTest", methodName = "main", fileName = "test242.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test243.kt:10) test + +User code: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test243.MainTest", methodName = "main", fileName = "test243.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test244.kt:10) test + +User code: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test244.MainTest", methodName = "main", fileName = "test244.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test245.kt:10) test + +User code: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test245.MainTest", methodName = "main", fileName = "test245.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at MainTest.main(test246.kt:10) test + +User code: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test247.kt:10) test + +User code: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test248.kt:10) test + +User code: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}") at MainTest.main(test252.kt:10) test + +User code: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") + } + +} +``` + +Remains as-is: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") + } + +} +``` + +
+ +### warn() { "warn messageBuilder" } at MainTest.main(test253.kt:10) test + +User code: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test253.MainTest", methodName = "main", fileName = "test253.kt", lineNumber = 10) + } + +} +``` + +### warn() { "warn messageBuilder $i" } at MainTest.main(test254.kt:10) test + +User code: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test254.MainTest", methodName = "main", fileName = "test254.kt", lineNumber = 10) + } + +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at MainTest.main(test255.kt:10) test + +User code: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test255.MainTest", methodName = "main", fileName = "test255.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at MainTest.main(test256.kt:10) test + +User code: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test256.MainTest", methodName = "main", fileName = "test256.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at MainTest.main(test257.kt:10) test + +User code: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test257.MainTest", methodName = "main", fileName = "test257.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test258.kt:10) test + +User code: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test258.MainTest", methodName = "main", fileName = "test258.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at MainTest.main(test259.kt:10) test + +User code: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test259.MainTest", methodName = "main", fileName = "test259.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test260.kt:10) test + +User code: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test260.MainTest", methodName = "main", fileName = "test260.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test261.kt:10) test + +User code: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test261.MainTest", methodName = "main", fileName = "test261.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at MainTest.main(test262.kt:10) test + +User code: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test263.kt:10) test + +User code: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test264.kt:10) test + +User code: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at MainTest.main(test265.kt:10) test + +User code: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at MainTest.main(test266.kt:10) test + +User code: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test267.kt:10) test + +User code: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at MainTest.main(test268.kt:10) test + +User code: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at MainTest.main(test269.kt:10) test + +User code: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test269.MainTest", methodName = "main", fileName = "test269.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at MainTest.main(test270.kt:10) test + +User code: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test270.MainTest", methodName = "main", fileName = "test270.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test271.kt:10) test + +User code: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test271.MainTest", methodName = "main", fileName = "test271.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test272.kt:10) test + +User code: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test272.MainTest", methodName = "main", fileName = "test272.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test273.kt:10) test + +User code: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test273.MainTest", methodName = "main", fileName = "test273.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test274.kt:10) test + +User code: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test274.MainTest", methodName = "main", fileName = "test274.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test275.kt:10) test + +User code: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test275.MainTest", methodName = "main", fileName = "test275.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test276.kt:10) test + +User code: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test276.MainTest", methodName = "main", fileName = "test276.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test277.kt:10) test + +User code: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test277.MainTest", methodName = "main", fileName = "test277.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at MainTest.main(test278.kt:10) test + +User code: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test279.kt:10) test + +User code: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test280.kt:10) test + +User code: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}", throwable) at MainTest.main(test284.kt:10) test + +User code: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) + } + +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at MainTest.main(test285.kt:10) test + +User code: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test285.MainTest", methodName = "main", fileName = "test285.kt", lineNumber = 10) + } + +} +``` + +### error(throwable) { "error messageBuilder $i" } at MainTest.main(test286.kt:10) test + +User code: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test286.MainTest", methodName = "main", fileName = "test286.kt", lineNumber = 10) + } + +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test287.kt:10) test + +User code: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test287.MainTest", methodName = "main", fileName = "test287.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=throwable } at MainTest.main(test288.kt:10) test + +User code: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test288.MainTest", methodName = "main", fileName = "test288.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test289.kt:10) test + +User code: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test289.MainTest", methodName = "main", fileName = "test289.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test290.kt:10) test + +User code: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test290.MainTest", methodName = "main", fileName = "test290.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at MainTest.main(test291.kt:10) test + +User code: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test291.MainTest", methodName = "main", fileName = "test291.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test292.kt:10) test + +User code: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test292.MainTest", methodName = "main", fileName = "test292.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test293.kt:10) test + +User code: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test293.MainTest", methodName = "main", fileName = "test293.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at MainTest.main(test294.kt:10) test + +User code: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test295.kt:10) test + +User code: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test296.kt:10) test + +User code: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at MainTest.main(test297.kt:10) test + +User code: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at MainTest.main(test298.kt:10) test + +User code: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test299.kt:10) test + +User code: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at MainTest.main(test300.kt:10) test + +User code: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at MainTest.main(test304.kt:10) test + +User code: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test304.MainTest", methodName = "main", fileName = "test304.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test305.kt:10) test + +User code: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test305.MainTest", methodName = "main", fileName = "test305.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test306.kt:10) test + +User code: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test306.MainTest", methodName = "main", fileName = "test306.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at MainTest.main(test307.kt:10) test + +User code: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test307.MainTest", methodName = "main", fileName = "test307.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test308.kt:10) test + +User code: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test308.MainTest", methodName = "main", fileName = "test308.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test309.kt:10) test + +User code: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test309.MainTest", methodName = "main", fileName = "test309.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at MainTest.main(test310.kt:10) test + +User code: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) + } + +} +``` + +Remains as-is: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test311.kt:10) test + +User code: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Remains as-is: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test312.kt:10) test + +User code: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Remains as-is: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}") at MainTest.main(test316.kt:10) test + +User code: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") + } + +} +``` + +Remains as-is: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") + } + +} +``` + +
+ +### error() { "error messageBuilder" } at MainTest.main(test317.kt:10) test + +User code: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test317.MainTest", methodName = "main", fileName = "test317.kt", lineNumber = 10) + } + +} +``` + +### error() { "error messageBuilder $i" } at MainTest.main(test318.kt:10) test + +User code: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test318.MainTest", methodName = "main", fileName = "test318.kt", lineNumber = 10) + } + +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at MainTest.main(test319.kt:10) test + +User code: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test319.MainTest", methodName = "main", fileName = "test319.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=null } at MainTest.main(test320.kt:10) test + +User code: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test320.MainTest", methodName = "main", fileName = "test320.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at MainTest.main(test321.kt:10) test + +User code: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test321.MainTest", methodName = "main", fileName = "test321.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test322.kt:10) test + +User code: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test322.MainTest", methodName = "main", fileName = "test322.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at MainTest.main(test323.kt:10) test + +User code: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test323.MainTest", methodName = "main", fileName = "test323.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at MainTest.main(test324.kt:10) test + +User code: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test324.MainTest", methodName = "main", fileName = "test324.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test325.kt:10) test + +User code: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test325.MainTest", methodName = "main", fileName = "test325.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
+ +
with class=false + +
entry/exit API + +### entry(argument1, argument2) at Test326Kt.main(test326.kt:10) test + +User code: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) +} +``` + +Transformed into: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entryWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "entry(argument1, argument2)", className = "test326.Test326Kt", methodName = "main", fileName = "test326.kt", lineNumber = 10)) +} +``` + +### exit(resultValue) at Test327Kt.main(test327.kt:10) test + +User code: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) +} +``` + +Transformed into: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "exit(resultValue)", className = "test327.Test327Kt", methodName = "main", fileName = "test327.kt", lineNumber = 10)) +} +``` + +### exit() at Test328Kt.main(test328.kt:10) test + +User code: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() +} +``` + +Transformed into: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(className = "test328.Test328Kt", methodName = "main", fileName = "test328.kt", lineNumber = 10)) +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at Test329Kt.main(test329.kt:10) test + +User code: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) +} +``` + +Transformed into: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "throwing(throwable)", className = "test329.Test329Kt", methodName = "main", fileName = "test329.kt", lineNumber = 10), throwable) +} +``` + +### catching(throwable) at Test330Kt.main(test330.kt:10) test + +User code: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) +} +``` + +Transformed into: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catchingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "catching(throwable)", className = "test330.Test330Kt", methodName = "main", fileName = "test330.kt", lineNumber = 10), throwable) +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at Test331Kt.main(test331.kt:10) test + +User code: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test332Kt.main(test332.kt:10) test + +User code: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test333Kt.main(test333.kt:10) test + +User code: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at Test334Kt.main(test334.kt:10) test + +User code: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at Test335Kt.main(test335.kt:10) test + +User code: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at Test336Kt.main(test336.kt:10) test + +User code: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at Test337Kt.main(test337.kt:10) test + +User code: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at Test338Kt.main(test338.kt:10) test + +User code: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test338.Test338Kt", methodName = "main", fileName = "test338.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at Test339Kt.main(test339.kt:10) test + +User code: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test339.Test339Kt", methodName = "main", fileName = "test339.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at Test340Kt.main(test340.kt:10) test + +User code: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test340.Test340Kt", methodName = "main", fileName = "test340.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at Test341Kt.main(test341.kt:10) test + +User code: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test341.Test341Kt", methodName = "main", fileName = "test341.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at Test342Kt.main(test342.kt:10) test + +User code: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test342.Test342Kt", methodName = "main", fileName = "test342.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test343Kt.main(test343.kt:10) test + +User code: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test343.Test343Kt", methodName = "main", fileName = "test343.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at Test344Kt.main(test344.kt:10) test + +User code: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test344.Test344Kt", methodName = "main", fileName = "test344.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at Test345Kt.main(test345.kt:10) test + +User code: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test345.Test345Kt", methodName = "main", fileName = "test345.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test346Kt.main(test346.kt:10) test + +User code: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test346.Test346Kt", methodName = "main", fileName = "test346.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at Test347Kt.main(test347.kt:10) test + +User code: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test348Kt.main(test348.kt:10) test + +User code: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test349Kt.main(test349.kt:10) test + +User code: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}", throwable) at Test353Kt.main(test353.kt:10) test + +User code: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) +} +``` + +Remains as-is: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at Test354Kt.main(test354.kt:10) test + +User code: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test354.Test354Kt", methodName = "main", fileName = "test354.kt", lineNumber = 10) +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at Test355Kt.main(test355.kt:10) test + +User code: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test355.Test355Kt", methodName = "main", fileName = "test355.kt", lineNumber = 10) +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at Test356Kt.main(test356.kt:10) test + +User code: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test356.Test356Kt", methodName = "main", fileName = "test356.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at Test357Kt.main(test357.kt:10) test + +User code: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test357.Test357Kt", methodName = "main", fileName = "test357.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at Test358Kt.main(test358.kt:10) test + +User code: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test358.Test358Kt", methodName = "main", fileName = "test358.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test359Kt.main(test359.kt:10) test + +User code: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test359.Test359Kt", methodName = "main", fileName = "test359.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at Test360Kt.main(test360.kt:10) test + +User code: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test360.Test360Kt", methodName = "main", fileName = "test360.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at Test361Kt.main(test361.kt:10) test + +User code: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test361.Test361Kt", methodName = "main", fileName = "test361.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test362Kt.main(test362.kt:10) test + +User code: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test362.Test362Kt", methodName = "main", fileName = "test362.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at Test363Kt.main(test363.kt:10) test + +User code: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test364Kt.main(test364.kt:10) test + +User code: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test365Kt.main(test365.kt:10) test + +User code: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at Test366Kt.main(test366.kt:10) test + +User code: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at Test367Kt.main(test367.kt:10) test + +User code: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at Test368Kt.main(test368.kt:10) test + +User code: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at Test369Kt.main(test369.kt:10) test + +User code: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at Test373Kt.main(test373.kt:10) test + +User code: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test373.Test373Kt", methodName = "main", fileName = "test373.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at Test374Kt.main(test374.kt:10) test + +User code: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test374.Test374Kt", methodName = "main", fileName = "test374.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test375Kt.main(test375.kt:10) test + +User code: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test375.Test375Kt", methodName = "main", fileName = "test375.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at Test376Kt.main(test376.kt:10) test + +User code: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test376.Test376Kt", methodName = "main", fileName = "test376.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at Test377Kt.main(test377.kt:10) test + +User code: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test377.Test377Kt", methodName = "main", fileName = "test377.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test378Kt.main(test378.kt:10) test + +User code: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test378.Test378Kt", methodName = "main", fileName = "test378.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at Test379Kt.main(test379.kt:10) test + +User code: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test380Kt.main(test380.kt:10) test + +User code: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test381Kt.main(test381.kt:10) test + +User code: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}") at Test385Kt.main(test385.kt:10) test + +User code: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") +} +``` + +Remains as-is: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") +} +``` + +
+ +### trace() { "trace messageBuilder" } at Test386Kt.main(test386.kt:10) test + +User code: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test386.Test386Kt", methodName = "main", fileName = "test386.kt", lineNumber = 10) +} +``` + +### trace() { "trace messageBuilder $i" } at Test387Kt.main(test387.kt:10) test + +User code: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test387.Test387Kt", methodName = "main", fileName = "test387.kt", lineNumber = 10) +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at Test388Kt.main(test388.kt:10) test + +User code: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test388.Test388Kt", methodName = "main", fileName = "test388.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at Test389Kt.main(test389.kt:10) test + +User code: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test389.Test389Kt", methodName = "main", fileName = "test389.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at Test390Kt.main(test390.kt:10) test + +User code: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test390.Test390Kt", methodName = "main", fileName = "test390.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at Test391Kt.main(test391.kt:10) test + +User code: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test391.Test391Kt", methodName = "main", fileName = "test391.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at Test392Kt.main(test392.kt:10) test + +User code: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test392.Test392Kt", methodName = "main", fileName = "test392.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at Test393Kt.main(test393.kt:10) test + +User code: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test393.Test393Kt", methodName = "main", fileName = "test393.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test394Kt.main(test394.kt:10) test + +User code: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test394.Test394Kt", methodName = "main", fileName = "test394.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at Test395Kt.main(test395.kt:10) test + +User code: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test396Kt.main(test396.kt:10) test + +User code: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test397Kt.main(test397.kt:10) test + +User code: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at Test398Kt.main(test398.kt:10) test + +User code: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at Test399Kt.main(test399.kt:10) test + +User code: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at Test400Kt.main(test400.kt:10) test + +User code: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at Test401Kt.main(test401.kt:10) test + +User code: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at Test402Kt.main(test402.kt:10) test + +User code: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test402.Test402Kt", methodName = "main", fileName = "test402.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at Test403Kt.main(test403.kt:10) test + +User code: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test403.Test403Kt", methodName = "main", fileName = "test403.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at Test404Kt.main(test404.kt:10) test + +User code: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test404.Test404Kt", methodName = "main", fileName = "test404.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at Test405Kt.main(test405.kt:10) test + +User code: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test405.Test405Kt", methodName = "main", fileName = "test405.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at Test406Kt.main(test406.kt:10) test + +User code: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test406.Test406Kt", methodName = "main", fileName = "test406.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test407Kt.main(test407.kt:10) test + +User code: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test407.Test407Kt", methodName = "main", fileName = "test407.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at Test408Kt.main(test408.kt:10) test + +User code: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test408.Test408Kt", methodName = "main", fileName = "test408.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at Test409Kt.main(test409.kt:10) test + +User code: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test409.Test409Kt", methodName = "main", fileName = "test409.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test410Kt.main(test410.kt:10) test + +User code: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test410.Test410Kt", methodName = "main", fileName = "test410.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at Test411Kt.main(test411.kt:10) test + +User code: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test412Kt.main(test412.kt:10) test + +User code: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test413Kt.main(test413.kt:10) test + +User code: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}", throwable) at Test417Kt.main(test417.kt:10) test + +User code: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) +} +``` + +Remains as-is: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at Test418Kt.main(test418.kt:10) test + +User code: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test418.Test418Kt", methodName = "main", fileName = "test418.kt", lineNumber = 10) +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at Test419Kt.main(test419.kt:10) test + +User code: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test419.Test419Kt", methodName = "main", fileName = "test419.kt", lineNumber = 10) +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at Test420Kt.main(test420.kt:10) test + +User code: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test420.Test420Kt", methodName = "main", fileName = "test420.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at Test421Kt.main(test421.kt:10) test + +User code: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test421.Test421Kt", methodName = "main", fileName = "test421.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at Test422Kt.main(test422.kt:10) test + +User code: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test422.Test422Kt", methodName = "main", fileName = "test422.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test423Kt.main(test423.kt:10) test + +User code: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test423.Test423Kt", methodName = "main", fileName = "test423.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at Test424Kt.main(test424.kt:10) test + +User code: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test424.Test424Kt", methodName = "main", fileName = "test424.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at Test425Kt.main(test425.kt:10) test + +User code: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test425.Test425Kt", methodName = "main", fileName = "test425.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test426Kt.main(test426.kt:10) test + +User code: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test426.Test426Kt", methodName = "main", fileName = "test426.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at Test427Kt.main(test427.kt:10) test + +User code: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test428Kt.main(test428.kt:10) test + +User code: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test429Kt.main(test429.kt:10) test + +User code: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at Test430Kt.main(test430.kt:10) test + +User code: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at Test431Kt.main(test431.kt:10) test + +User code: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at Test432Kt.main(test432.kt:10) test + +User code: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at Test433Kt.main(test433.kt:10) test + +User code: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at Test437Kt.main(test437.kt:10) test + +User code: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test437.Test437Kt", methodName = "main", fileName = "test437.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at Test438Kt.main(test438.kt:10) test + +User code: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test438.Test438Kt", methodName = "main", fileName = "test438.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test439Kt.main(test439.kt:10) test + +User code: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test439.Test439Kt", methodName = "main", fileName = "test439.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at Test440Kt.main(test440.kt:10) test + +User code: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test440.Test440Kt", methodName = "main", fileName = "test440.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at Test441Kt.main(test441.kt:10) test + +User code: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test441.Test441Kt", methodName = "main", fileName = "test441.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test442Kt.main(test442.kt:10) test + +User code: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test442.Test442Kt", methodName = "main", fileName = "test442.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at Test443Kt.main(test443.kt:10) test + +User code: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test444Kt.main(test444.kt:10) test + +User code: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test445Kt.main(test445.kt:10) test + +User code: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}") at Test449Kt.main(test449.kt:10) test + +User code: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") +} +``` + +Remains as-is: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") +} +``` + +
+ +### debug() { "debug messageBuilder" } at Test450Kt.main(test450.kt:10) test + +User code: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test450.Test450Kt", methodName = "main", fileName = "test450.kt", lineNumber = 10) +} +``` + +### debug() { "debug messageBuilder $i" } at Test451Kt.main(test451.kt:10) test + +User code: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test451.Test451Kt", methodName = "main", fileName = "test451.kt", lineNumber = 10) +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at Test452Kt.main(test452.kt:10) test + +User code: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test452.Test452Kt", methodName = "main", fileName = "test452.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at Test453Kt.main(test453.kt:10) test + +User code: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test453.Test453Kt", methodName = "main", fileName = "test453.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at Test454Kt.main(test454.kt:10) test + +User code: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test454.Test454Kt", methodName = "main", fileName = "test454.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at Test455Kt.main(test455.kt:10) test + +User code: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test455.Test455Kt", methodName = "main", fileName = "test455.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at Test456Kt.main(test456.kt:10) test + +User code: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test456.Test456Kt", methodName = "main", fileName = "test456.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at Test457Kt.main(test457.kt:10) test + +User code: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test457.Test457Kt", methodName = "main", fileName = "test457.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test458Kt.main(test458.kt:10) test + +User code: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test458.Test458Kt", methodName = "main", fileName = "test458.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at Test459Kt.main(test459.kt:10) test + +User code: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test460Kt.main(test460.kt:10) test + +User code: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test461Kt.main(test461.kt:10) test + +User code: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at Test462Kt.main(test462.kt:10) test + +User code: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at Test463Kt.main(test463.kt:10) test + +User code: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at Test464Kt.main(test464.kt:10) test + +User code: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at Test465Kt.main(test465.kt:10) test + +User code: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at Test466Kt.main(test466.kt:10) test + +User code: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test466.Test466Kt", methodName = "main", fileName = "test466.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at Test467Kt.main(test467.kt:10) test + +User code: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test467.Test467Kt", methodName = "main", fileName = "test467.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at Test468Kt.main(test468.kt:10) test + +User code: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test468.Test468Kt", methodName = "main", fileName = "test468.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at Test469Kt.main(test469.kt:10) test + +User code: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test469.Test469Kt", methodName = "main", fileName = "test469.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at Test470Kt.main(test470.kt:10) test + +User code: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test470.Test470Kt", methodName = "main", fileName = "test470.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test471Kt.main(test471.kt:10) test + +User code: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test471.Test471Kt", methodName = "main", fileName = "test471.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at Test472Kt.main(test472.kt:10) test + +User code: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test472.Test472Kt", methodName = "main", fileName = "test472.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at Test473Kt.main(test473.kt:10) test + +User code: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test473.Test473Kt", methodName = "main", fileName = "test473.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test474Kt.main(test474.kt:10) test + +User code: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test474.Test474Kt", methodName = "main", fileName = "test474.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at Test475Kt.main(test475.kt:10) test + +User code: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test476Kt.main(test476.kt:10) test + +User code: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test477Kt.main(test477.kt:10) test + +User code: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### info("info message {}", throwable) at Test481Kt.main(test481.kt:10) test + +User code: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) +} +``` + +Remains as-is: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at Test482Kt.main(test482.kt:10) test + +User code: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test482.Test482Kt", methodName = "main", fileName = "test482.kt", lineNumber = 10) +} +``` + +### info(throwable) { "info messageBuilder $i" } at Test483Kt.main(test483.kt:10) test + +User code: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test483.Test483Kt", methodName = "main", fileName = "test483.kt", lineNumber = 10) +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at Test484Kt.main(test484.kt:10) test + +User code: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test484.Test484Kt", methodName = "main", fileName = "test484.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at Test485Kt.main(test485.kt:10) test + +User code: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test485.Test485Kt", methodName = "main", fileName = "test485.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at Test486Kt.main(test486.kt:10) test + +User code: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test486.Test486Kt", methodName = "main", fileName = "test486.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test487Kt.main(test487.kt:10) test + +User code: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test487.Test487Kt", methodName = "main", fileName = "test487.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at Test488Kt.main(test488.kt:10) test + +User code: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test488.Test488Kt", methodName = "main", fileName = "test488.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at Test489Kt.main(test489.kt:10) test + +User code: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test489.Test489Kt", methodName = "main", fileName = "test489.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test490Kt.main(test490.kt:10) test + +User code: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test490.Test490Kt", methodName = "main", fileName = "test490.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at Test491Kt.main(test491.kt:10) test + +User code: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test492Kt.main(test492.kt:10) test + +User code: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test493Kt.main(test493.kt:10) test + +User code: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at Test494Kt.main(test494.kt:10) test + +User code: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at Test495Kt.main(test495.kt:10) test + +User code: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at Test496Kt.main(test496.kt:10) test + +User code: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at Test497Kt.main(test497.kt:10) test + +User code: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at Test501Kt.main(test501.kt:10) test + +User code: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test501.Test501Kt", methodName = "main", fileName = "test501.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at Test502Kt.main(test502.kt:10) test + +User code: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test502.Test502Kt", methodName = "main", fileName = "test502.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test503Kt.main(test503.kt:10) test + +User code: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test503.Test503Kt", methodName = "main", fileName = "test503.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at Test504Kt.main(test504.kt:10) test + +User code: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test504.Test504Kt", methodName = "main", fileName = "test504.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at Test505Kt.main(test505.kt:10) test + +User code: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test505.Test505Kt", methodName = "main", fileName = "test505.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test506Kt.main(test506.kt:10) test + +User code: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test506.Test506Kt", methodName = "main", fileName = "test506.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at Test507Kt.main(test507.kt:10) test + +User code: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test508Kt.main(test508.kt:10) test + +User code: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test509Kt.main(test509.kt:10) test + +User code: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### info("info message {}") at Test513Kt.main(test513.kt:10) test + +User code: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") +} +``` + +Remains as-is: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") +} +``` + +
+ +### info() { "info messageBuilder" } at Test514Kt.main(test514.kt:10) test + +User code: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test514.Test514Kt", methodName = "main", fileName = "test514.kt", lineNumber = 10) +} +``` + +### info() { "info messageBuilder $i" } at Test515Kt.main(test515.kt:10) test + +User code: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test515.Test515Kt", methodName = "main", fileName = "test515.kt", lineNumber = 10) +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at Test516Kt.main(test516.kt:10) test + +User code: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test516.Test516Kt", methodName = "main", fileName = "test516.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=null } at Test517Kt.main(test517.kt:10) test + +User code: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test517.Test517Kt", methodName = "main", fileName = "test517.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at Test518Kt.main(test518.kt:10) test + +User code: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test518.Test518Kt", methodName = "main", fileName = "test518.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at Test519Kt.main(test519.kt:10) test + +User code: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test519.Test519Kt", methodName = "main", fileName = "test519.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at Test520Kt.main(test520.kt:10) test + +User code: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test520.Test520Kt", methodName = "main", fileName = "test520.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at Test521Kt.main(test521.kt:10) test + +User code: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test521.Test521Kt", methodName = "main", fileName = "test521.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at Test522Kt.main(test522.kt:10) test + +User code: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test522.Test522Kt", methodName = "main", fileName = "test522.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at Test523Kt.main(test523.kt:10) test + +User code: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test524Kt.main(test524.kt:10) test + +User code: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test525Kt.main(test525.kt:10) test + +User code: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at Test526Kt.main(test526.kt:10) test + +User code: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at Test527Kt.main(test527.kt:10) test + +User code: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at Test528Kt.main(test528.kt:10) test + +User code: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at Test529Kt.main(test529.kt:10) test + +User code: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at Test530Kt.main(test530.kt:10) test + +User code: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test530.Test530Kt", methodName = "main", fileName = "test530.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at Test531Kt.main(test531.kt:10) test + +User code: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test531.Test531Kt", methodName = "main", fileName = "test531.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at Test532Kt.main(test532.kt:10) test + +User code: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test532.Test532Kt", methodName = "main", fileName = "test532.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at Test533Kt.main(test533.kt:10) test + +User code: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test533.Test533Kt", methodName = "main", fileName = "test533.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at Test534Kt.main(test534.kt:10) test + +User code: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test534.Test534Kt", methodName = "main", fileName = "test534.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test535Kt.main(test535.kt:10) test + +User code: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test535.Test535Kt", methodName = "main", fileName = "test535.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at Test536Kt.main(test536.kt:10) test + +User code: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test536.Test536Kt", methodName = "main", fileName = "test536.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at Test537Kt.main(test537.kt:10) test + +User code: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test537.Test537Kt", methodName = "main", fileName = "test537.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test538Kt.main(test538.kt:10) test + +User code: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test538.Test538Kt", methodName = "main", fileName = "test538.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at Test539Kt.main(test539.kt:10) test + +User code: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test540Kt.main(test540.kt:10) test + +User code: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test541Kt.main(test541.kt:10) test + +User code: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}", throwable) at Test545Kt.main(test545.kt:10) test + +User code: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) +} +``` + +Remains as-is: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at Test546Kt.main(test546.kt:10) test + +User code: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test546.Test546Kt", methodName = "main", fileName = "test546.kt", lineNumber = 10) +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at Test547Kt.main(test547.kt:10) test + +User code: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test547.Test547Kt", methodName = "main", fileName = "test547.kt", lineNumber = 10) +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at Test548Kt.main(test548.kt:10) test + +User code: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test548.Test548Kt", methodName = "main", fileName = "test548.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at Test549Kt.main(test549.kt:10) test + +User code: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test549.Test549Kt", methodName = "main", fileName = "test549.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at Test550Kt.main(test550.kt:10) test + +User code: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test550.Test550Kt", methodName = "main", fileName = "test550.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test551Kt.main(test551.kt:10) test + +User code: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test551.Test551Kt", methodName = "main", fileName = "test551.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at Test552Kt.main(test552.kt:10) test + +User code: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test552.Test552Kt", methodName = "main", fileName = "test552.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at Test553Kt.main(test553.kt:10) test + +User code: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test553.Test553Kt", methodName = "main", fileName = "test553.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test554Kt.main(test554.kt:10) test + +User code: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test554.Test554Kt", methodName = "main", fileName = "test554.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at Test555Kt.main(test555.kt:10) test + +User code: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test556Kt.main(test556.kt:10) test + +User code: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test557Kt.main(test557.kt:10) test + +User code: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at Test558Kt.main(test558.kt:10) test + +User code: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at Test559Kt.main(test559.kt:10) test + +User code: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at Test560Kt.main(test560.kt:10) test + +User code: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at Test561Kt.main(test561.kt:10) test + +User code: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at Test565Kt.main(test565.kt:10) test + +User code: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test565.Test565Kt", methodName = "main", fileName = "test565.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at Test566Kt.main(test566.kt:10) test + +User code: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test566.Test566Kt", methodName = "main", fileName = "test566.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test567Kt.main(test567.kt:10) test + +User code: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test567.Test567Kt", methodName = "main", fileName = "test567.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at Test568Kt.main(test568.kt:10) test + +User code: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test568.Test568Kt", methodName = "main", fileName = "test568.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at Test569Kt.main(test569.kt:10) test + +User code: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test569.Test569Kt", methodName = "main", fileName = "test569.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test570Kt.main(test570.kt:10) test + +User code: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test570.Test570Kt", methodName = "main", fileName = "test570.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at Test571Kt.main(test571.kt:10) test + +User code: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test572Kt.main(test572.kt:10) test + +User code: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test573Kt.main(test573.kt:10) test + +User code: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}") at Test577Kt.main(test577.kt:10) test + +User code: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") +} +``` + +Remains as-is: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") +} +``` + +
+ +### warn() { "warn messageBuilder" } at Test578Kt.main(test578.kt:10) test + +User code: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test578.Test578Kt", methodName = "main", fileName = "test578.kt", lineNumber = 10) +} +``` + +### warn() { "warn messageBuilder $i" } at Test579Kt.main(test579.kt:10) test + +User code: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test579.Test579Kt", methodName = "main", fileName = "test579.kt", lineNumber = 10) +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at Test580Kt.main(test580.kt:10) test + +User code: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test580.Test580Kt", methodName = "main", fileName = "test580.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at Test581Kt.main(test581.kt:10) test + +User code: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test581.Test581Kt", methodName = "main", fileName = "test581.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at Test582Kt.main(test582.kt:10) test + +User code: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test582.Test582Kt", methodName = "main", fileName = "test582.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at Test583Kt.main(test583.kt:10) test + +User code: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test583.Test583Kt", methodName = "main", fileName = "test583.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at Test584Kt.main(test584.kt:10) test + +User code: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test584.Test584Kt", methodName = "main", fileName = "test584.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at Test585Kt.main(test585.kt:10) test + +User code: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test585.Test585Kt", methodName = "main", fileName = "test585.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test586Kt.main(test586.kt:10) test + +User code: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test586.Test586Kt", methodName = "main", fileName = "test586.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at Test587Kt.main(test587.kt:10) test + +User code: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test588Kt.main(test588.kt:10) test + +User code: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test589Kt.main(test589.kt:10) test + +User code: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at Test590Kt.main(test590.kt:10) test + +User code: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at Test591Kt.main(test591.kt:10) test + +User code: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at Test592Kt.main(test592.kt:10) test + +User code: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at Test593Kt.main(test593.kt:10) test + +User code: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at Test594Kt.main(test594.kt:10) test + +User code: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test594.Test594Kt", methodName = "main", fileName = "test594.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at Test595Kt.main(test595.kt:10) test + +User code: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test595.Test595Kt", methodName = "main", fileName = "test595.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at Test596Kt.main(test596.kt:10) test + +User code: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test596.Test596Kt", methodName = "main", fileName = "test596.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at Test597Kt.main(test597.kt:10) test + +User code: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test597.Test597Kt", methodName = "main", fileName = "test597.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at Test598Kt.main(test598.kt:10) test + +User code: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test598.Test598Kt", methodName = "main", fileName = "test598.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test599Kt.main(test599.kt:10) test + +User code: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test599.Test599Kt", methodName = "main", fileName = "test599.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at Test600Kt.main(test600.kt:10) test + +User code: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test600.Test600Kt", methodName = "main", fileName = "test600.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at Test601Kt.main(test601.kt:10) test + +User code: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test601.Test601Kt", methodName = "main", fileName = "test601.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test602Kt.main(test602.kt:10) test + +User code: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test602.Test602Kt", methodName = "main", fileName = "test602.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at Test603Kt.main(test603.kt:10) test + +User code: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) +} +``` + +Remains as-is: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test604Kt.main(test604.kt:10) test + +User code: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test605Kt.main(test605.kt:10) test + +User code: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +
+ +### error("error message {}", throwable) at Test609Kt.main(test609.kt:10) test + +User code: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) +} +``` + +Remains as-is: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at Test610Kt.main(test610.kt:10) test + +User code: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test610.Test610Kt", methodName = "main", fileName = "test610.kt", lineNumber = 10) +} +``` + +### error(throwable) { "error messageBuilder $i" } at Test611Kt.main(test611.kt:10) test + +User code: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test611.Test611Kt", methodName = "main", fileName = "test611.kt", lineNumber = 10) +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at Test612Kt.main(test612.kt:10) test + +User code: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test612.Test612Kt", methodName = "main", fileName = "test612.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=throwable } at Test613Kt.main(test613.kt:10) test + +User code: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test613.Test613Kt", methodName = "main", fileName = "test613.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at Test614Kt.main(test614.kt:10) test + +User code: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test614.Test614Kt", methodName = "main", fileName = "test614.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test615Kt.main(test615.kt:10) test + +User code: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test615.Test615Kt", methodName = "main", fileName = "test615.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at Test616Kt.main(test616.kt:10) test + +User code: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test616.Test616Kt", methodName = "main", fileName = "test616.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at Test617Kt.main(test617.kt:10) test + +User code: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test617.Test617Kt", methodName = "main", fileName = "test617.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test618Kt.main(test618.kt:10) test + +User code: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test618.Test618Kt", methodName = "main", fileName = "test618.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at Test619Kt.main(test619.kt:10) test + +User code: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test620Kt.main(test620.kt:10) test + +User code: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test621Kt.main(test621.kt:10) test + +User code: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at Test622Kt.main(test622.kt:10) test + +User code: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at Test623Kt.main(test623.kt:10) test + +User code: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at Test624Kt.main(test624.kt:10) test + +User code: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at Test625Kt.main(test625.kt:10) test + +User code: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Remains as-is: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at Test629Kt.main(test629.kt:10) test + +User code: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test629.Test629Kt", methodName = "main", fileName = "test629.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at Test630Kt.main(test630.kt:10) test + +User code: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test630.Test630Kt", methodName = "main", fileName = "test630.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test631Kt.main(test631.kt:10) test + +User code: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test631.Test631Kt", methodName = "main", fileName = "test631.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at Test632Kt.main(test632.kt:10) test + +User code: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test632.Test632Kt", methodName = "main", fileName = "test632.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at Test633Kt.main(test633.kt:10) test + +User code: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test633.Test633Kt", methodName = "main", fileName = "test633.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test634Kt.main(test634.kt:10) test + +User code: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test634.Test634Kt", methodName = "main", fileName = "test634.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at Test635Kt.main(test635.kt:10) test + +User code: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) +} +``` + +Remains as-is: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test636Kt.main(test636.kt:10) test + +User code: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Remains as-is: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test637Kt.main(test637.kt:10) test + +User code: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Remains as-is: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +
+ +### error("error message {}") at Test641Kt.main(test641.kt:10) test + +User code: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") +} +``` + +Remains as-is: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") +} +``` + +
+ +### error() { "error messageBuilder" } at Test642Kt.main(test642.kt:10) test + +User code: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test642.Test642Kt", methodName = "main", fileName = "test642.kt", lineNumber = 10) +} +``` + +### error() { "error messageBuilder $i" } at Test643Kt.main(test643.kt:10) test + +User code: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test643.Test643Kt", methodName = "main", fileName = "test643.kt", lineNumber = 10) +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at Test644Kt.main(test644.kt:10) test + +User code: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test644.Test644Kt", methodName = "main", fileName = "test644.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=null } at Test645Kt.main(test645.kt:10) test + +User code: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test645.Test645Kt", methodName = "main", fileName = "test645.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at Test646Kt.main(test646.kt:10) test + +User code: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test646.Test646Kt", methodName = "main", fileName = "test646.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at Test647Kt.main(test647.kt:10) test + +User code: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test647.Test647Kt", methodName = "main", fileName = "test647.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at Test648Kt.main(test648.kt:10) test + +User code: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test648.Test648Kt", methodName = "main", fileName = "test648.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at Test649Kt.main(test649.kt:10) test + +User code: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test649.Test649Kt", methodName = "main", fileName = "test649.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at Test650Kt.main(test650.kt:10) test + +User code: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test650.Test650Kt", methodName = "main", fileName = "test650.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
+ +
featureFlag=DISABLE_TRANSFORMING_ENTRY_EXIT_API + +
with class=true + +
entry/exit API + +### entry(argument1, argument2) at MainTest.main(test1.kt:10) test + +User code: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) + } + +} +``` + +Remains as-is: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) + } + +} +``` + +### exit(resultValue) at MainTest.main(test2.kt:10) test + +User code: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) + } + +} +``` + +Remains as-is: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) + } + +} +``` + +### exit() at MainTest.main(test3.kt:10) test + +User code: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() + } + +} +``` + +Remains as-is: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() + } + +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at MainTest.main(test4.kt:10) test + +User code: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) + } + +} +``` + +Transformed into: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "throwing(throwable)", className = "test4.MainTest", methodName = "main", fileName = "test4.kt", lineNumber = 10), throwable) + } + +} +``` + +### catching(throwable) at MainTest.main(test5.kt:10) test + +User code: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) + } + +} +``` + +Transformed into: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catchingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "catching(throwable)", className = "test5.MainTest", methodName = "main", fileName = "test5.kt", lineNumber = 10), throwable) + } + +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at MainTest.main(test6.kt:10) test + +User code: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test6.MainTest", methodName = "main", fileName = "test6.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test7.kt:10) test + +User code: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test7.MainTest", methodName = "main", fileName = "test7.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test8.kt:10) test + +User code: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test8.MainTest", methodName = "main", fileName = "test8.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at MainTest.main(test9.kt:10) test + +User code: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test9.MainTest", methodName = "main", fileName = "test9.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at MainTest.main(test10.kt:10) test + +User code: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test10.MainTest", methodName = "main", fileName = "test10.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test11.kt:10) test + +User code: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test11.MainTest", methodName = "main", fileName = "test11.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at MainTest.main(test12.kt:10) test + +User code: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test12.MainTest", methodName = "main", fileName = "test12.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at MainTest.main(test13.kt:10) test + +User code: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test13.MainTest", methodName = "main", fileName = "test13.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at MainTest.main(test14.kt:10) test + +User code: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test14.MainTest", methodName = "main", fileName = "test14.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test15.kt:10) test + +User code: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test15.MainTest", methodName = "main", fileName = "test15.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test16.kt:10) test + +User code: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test16.MainTest", methodName = "main", fileName = "test16.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test17.kt:10) test + +User code: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test17.MainTest", methodName = "main", fileName = "test17.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test18.kt:10) test + +User code: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test18.MainTest", methodName = "main", fileName = "test18.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test19.kt:10) test + +User code: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test19.MainTest", methodName = "main", fileName = "test19.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test20.kt:10) test + +User code: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test20.MainTest", methodName = "main", fileName = "test20.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test21.kt:10) test + +User code: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test21.MainTest", methodName = "main", fileName = "test21.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at MainTest.main(test22.kt:10) test + +User code: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test22.MainTest", methodName = "main", fileName = "test22.kt", lineNumber = 10) + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test23.kt:10) test + +User code: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test23.MainTest", methodName = "main", fileName = "test23.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test24.kt:10) test + +User code: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test24.MainTest", methodName = "main", fileName = "test24.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}", throwable) at MainTest.main(test28.kt:10) test + +User code: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test28.MainTest", methodName = "main", fileName = "test28.kt", lineNumber = 10) + } + +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at MainTest.main(test29.kt:10) test + +User code: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test29.MainTest", methodName = "main", fileName = "test29.kt", lineNumber = 10) + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at MainTest.main(test30.kt:10) test + +User code: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test30.MainTest", methodName = "main", fileName = "test30.kt", lineNumber = 10) + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test31.kt:10) test + +User code: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test31.MainTest", methodName = "main", fileName = "test31.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at MainTest.main(test32.kt:10) test + +User code: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test32.MainTest", methodName = "main", fileName = "test32.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test33.kt:10) test + +User code: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test33.MainTest", methodName = "main", fileName = "test33.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test34.kt:10) test + +User code: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test34.MainTest", methodName = "main", fileName = "test34.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test35.kt:10) test + +User code: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test35.MainTest", methodName = "main", fileName = "test35.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test36.kt:10) test + +User code: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test36.MainTest", methodName = "main", fileName = "test36.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test37.kt:10) test + +User code: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test37.MainTest", methodName = "main", fileName = "test37.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at MainTest.main(test38.kt:10) test + +User code: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test38.MainTest", methodName = "main", fileName = "test38.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test39.kt:10) test + +User code: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test39.MainTest", methodName = "main", fileName = "test39.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test40.kt:10) test + +User code: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test40.MainTest", methodName = "main", fileName = "test40.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at MainTest.main(test41.kt:10) test + +User code: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test41.MainTest", methodName = "main", fileName = "test41.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at MainTest.main(test42.kt:10) test + +User code: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test42.MainTest", methodName = "main", fileName = "test42.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test43.kt:10) test + +User code: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test43.MainTest", methodName = "main", fileName = "test43.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at MainTest.main(test44.kt:10) test + +User code: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test44.MainTest", methodName = "main", fileName = "test44.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test48.kt:10) test + +User code: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test48.MainTest", methodName = "main", fileName = "test48.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test49.kt:10) test + +User code: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test49.MainTest", methodName = "main", fileName = "test49.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test50.kt:10) test + +User code: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test50.MainTest", methodName = "main", fileName = "test50.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test51.kt:10) test + +User code: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test51.MainTest", methodName = "main", fileName = "test51.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test52.kt:10) test + +User code: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test52.MainTest", methodName = "main", fileName = "test52.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test53.kt:10) test + +User code: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test53.MainTest", methodName = "main", fileName = "test53.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at MainTest.main(test54.kt:10) test + +User code: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test54.MainTest", methodName = "main", fileName = "test54.kt", lineNumber = 10) + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test55.kt:10) test + +User code: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test55.MainTest", methodName = "main", fileName = "test55.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test56.kt:10) test + +User code: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test56.MainTest", methodName = "main", fileName = "test56.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}") at MainTest.main(test60.kt:10) test + +User code: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") + } + +} +``` + +Transformed into: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test60.MainTest", methodName = "main", fileName = "test60.kt", lineNumber = 10) + } + +} +``` + +
+ +### trace() { "trace messageBuilder" } at MainTest.main(test61.kt:10) test + +User code: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test61.MainTest", methodName = "main", fileName = "test61.kt", lineNumber = 10) + } + +} +``` + +### trace() { "trace messageBuilder $i" } at MainTest.main(test62.kt:10) test + +User code: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test62.MainTest", methodName = "main", fileName = "test62.kt", lineNumber = 10) + } + +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at MainTest.main(test63.kt:10) test + +User code: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test63.MainTest", methodName = "main", fileName = "test63.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at MainTest.main(test64.kt:10) test + +User code: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test64.MainTest", methodName = "main", fileName = "test64.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at MainTest.main(test65.kt:10) test + +User code: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test65.MainTest", methodName = "main", fileName = "test65.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test66.kt:10) test + +User code: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test66.MainTest", methodName = "main", fileName = "test66.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at MainTest.main(test67.kt:10) test + +User code: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test67.MainTest", methodName = "main", fileName = "test67.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test68.kt:10) test + +User code: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test68.MainTest", methodName = "main", fileName = "test68.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test69.kt:10) test + +User code: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test69.MainTest", methodName = "main", fileName = "test69.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at MainTest.main(test70.kt:10) test + +User code: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test70.MainTest", methodName = "main", fileName = "test70.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test71.kt:10) test + +User code: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test71.MainTest", methodName = "main", fileName = "test71.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test72.kt:10) test + +User code: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test72.MainTest", methodName = "main", fileName = "test72.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at MainTest.main(test73.kt:10) test + +User code: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test73.MainTest", methodName = "main", fileName = "test73.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at MainTest.main(test74.kt:10) test + +User code: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test74.MainTest", methodName = "main", fileName = "test74.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test75.kt:10) test + +User code: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test75.MainTest", methodName = "main", fileName = "test75.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at MainTest.main(test76.kt:10) test + +User code: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test76.MainTest", methodName = "main", fileName = "test76.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at MainTest.main(test77.kt:10) test + +User code: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test77.MainTest", methodName = "main", fileName = "test77.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at MainTest.main(test78.kt:10) test + +User code: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test78.MainTest", methodName = "main", fileName = "test78.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test79.kt:10) test + +User code: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test79.MainTest", methodName = "main", fileName = "test79.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test80.kt:10) test + +User code: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test80.MainTest", methodName = "main", fileName = "test80.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test81.kt:10) test + +User code: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test81.MainTest", methodName = "main", fileName = "test81.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test82.kt:10) test + +User code: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test82.MainTest", methodName = "main", fileName = "test82.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test83.kt:10) test + +User code: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test83.MainTest", methodName = "main", fileName = "test83.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test84.kt:10) test + +User code: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test84.MainTest", methodName = "main", fileName = "test84.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test85.kt:10) test + +User code: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test85.MainTest", methodName = "main", fileName = "test85.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at MainTest.main(test86.kt:10) test + +User code: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test86.MainTest", methodName = "main", fileName = "test86.kt", lineNumber = 10) + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test87.kt:10) test + +User code: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test87.MainTest", methodName = "main", fileName = "test87.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test88.kt:10) test + +User code: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test88.MainTest", methodName = "main", fileName = "test88.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}", throwable) at MainTest.main(test92.kt:10) test + +User code: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test92.MainTest", methodName = "main", fileName = "test92.kt", lineNumber = 10) + } + +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at MainTest.main(test93.kt:10) test + +User code: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test93.MainTest", methodName = "main", fileName = "test93.kt", lineNumber = 10) + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at MainTest.main(test94.kt:10) test + +User code: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test94.MainTest", methodName = "main", fileName = "test94.kt", lineNumber = 10) + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test95.kt:10) test + +User code: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test95.MainTest", methodName = "main", fileName = "test95.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at MainTest.main(test96.kt:10) test + +User code: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test96.MainTest", methodName = "main", fileName = "test96.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test97.kt:10) test + +User code: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test97.MainTest", methodName = "main", fileName = "test97.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test98.kt:10) test + +User code: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test98.MainTest", methodName = "main", fileName = "test98.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test99.kt:10) test + +User code: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test99.MainTest", methodName = "main", fileName = "test99.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test100.kt:10) test + +User code: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test100.MainTest", methodName = "main", fileName = "test100.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test101.kt:10) test + +User code: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test101.MainTest", methodName = "main", fileName = "test101.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at MainTest.main(test102.kt:10) test + +User code: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test102.MainTest", methodName = "main", fileName = "test102.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test103.kt:10) test + +User code: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test103.MainTest", methodName = "main", fileName = "test103.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test104.kt:10) test + +User code: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test104.MainTest", methodName = "main", fileName = "test104.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at MainTest.main(test105.kt:10) test + +User code: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test105.MainTest", methodName = "main", fileName = "test105.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at MainTest.main(test106.kt:10) test + +User code: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test106.MainTest", methodName = "main", fileName = "test106.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test107.kt:10) test + +User code: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test107.MainTest", methodName = "main", fileName = "test107.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at MainTest.main(test108.kt:10) test + +User code: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test108.MainTest", methodName = "main", fileName = "test108.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test112.kt:10) test + +User code: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test112.MainTest", methodName = "main", fileName = "test112.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test113.kt:10) test + +User code: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test113.MainTest", methodName = "main", fileName = "test113.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test114.kt:10) test + +User code: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test114.MainTest", methodName = "main", fileName = "test114.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test115.kt:10) test + +User code: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test115.MainTest", methodName = "main", fileName = "test115.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test116.kt:10) test + +User code: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test116.MainTest", methodName = "main", fileName = "test116.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test117.kt:10) test + +User code: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test117.MainTest", methodName = "main", fileName = "test117.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at MainTest.main(test118.kt:10) test + +User code: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test118.MainTest", methodName = "main", fileName = "test118.kt", lineNumber = 10) + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test119.kt:10) test + +User code: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test119.MainTest", methodName = "main", fileName = "test119.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test120.kt:10) test + +User code: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test120.MainTest", methodName = "main", fileName = "test120.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}") at MainTest.main(test124.kt:10) test + +User code: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") + } + +} +``` + +Transformed into: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test124.MainTest", methodName = "main", fileName = "test124.kt", lineNumber = 10) + } + +} +``` + +
+ +### debug() { "debug messageBuilder" } at MainTest.main(test125.kt:10) test + +User code: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test125.MainTest", methodName = "main", fileName = "test125.kt", lineNumber = 10) + } + +} +``` + +### debug() { "debug messageBuilder $i" } at MainTest.main(test126.kt:10) test + +User code: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test126.MainTest", methodName = "main", fileName = "test126.kt", lineNumber = 10) + } + +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at MainTest.main(test127.kt:10) test + +User code: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test127.MainTest", methodName = "main", fileName = "test127.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at MainTest.main(test128.kt:10) test + +User code: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test128.MainTest", methodName = "main", fileName = "test128.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at MainTest.main(test129.kt:10) test + +User code: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test129.MainTest", methodName = "main", fileName = "test129.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test130.kt:10) test + +User code: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test130.MainTest", methodName = "main", fileName = "test130.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at MainTest.main(test131.kt:10) test + +User code: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test131.MainTest", methodName = "main", fileName = "test131.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test132.kt:10) test + +User code: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test132.MainTest", methodName = "main", fileName = "test132.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test133.kt:10) test + +User code: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test133.MainTest", methodName = "main", fileName = "test133.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at MainTest.main(test134.kt:10) test + +User code: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test134.MainTest", methodName = "main", fileName = "test134.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test135.kt:10) test + +User code: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test135.MainTest", methodName = "main", fileName = "test135.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test136.kt:10) test + +User code: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test136.MainTest", methodName = "main", fileName = "test136.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at MainTest.main(test137.kt:10) test + +User code: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test137.MainTest", methodName = "main", fileName = "test137.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at MainTest.main(test138.kt:10) test + +User code: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test138.MainTest", methodName = "main", fileName = "test138.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test139.kt:10) test + +User code: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test139.MainTest", methodName = "main", fileName = "test139.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at MainTest.main(test140.kt:10) test + +User code: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test140.MainTest", methodName = "main", fileName = "test140.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at MainTest.main(test141.kt:10) test + +User code: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test141.MainTest", methodName = "main", fileName = "test141.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at MainTest.main(test142.kt:10) test + +User code: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test142.MainTest", methodName = "main", fileName = "test142.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test143.kt:10) test + +User code: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test143.MainTest", methodName = "main", fileName = "test143.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test144.kt:10) test + +User code: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test144.MainTest", methodName = "main", fileName = "test144.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test145.kt:10) test + +User code: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test145.MainTest", methodName = "main", fileName = "test145.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test146.kt:10) test + +User code: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test146.MainTest", methodName = "main", fileName = "test146.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test147.kt:10) test + +User code: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test147.MainTest", methodName = "main", fileName = "test147.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test148.kt:10) test + +User code: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test148.MainTest", methodName = "main", fileName = "test148.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test149.kt:10) test + +User code: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test149.MainTest", methodName = "main", fileName = "test149.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at MainTest.main(test150.kt:10) test + +User code: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test150.MainTest", methodName = "main", fileName = "test150.kt", lineNumber = 10) + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test151.kt:10) test + +User code: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test151.MainTest", methodName = "main", fileName = "test151.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test152.kt:10) test + +User code: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test152.MainTest", methodName = "main", fileName = "test152.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}", throwable) at MainTest.main(test156.kt:10) test + +User code: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test156.MainTest", methodName = "main", fileName = "test156.kt", lineNumber = 10) + } + +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at MainTest.main(test157.kt:10) test + +User code: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test157.MainTest", methodName = "main", fileName = "test157.kt", lineNumber = 10) + } + +} +``` + +### info(throwable) { "info messageBuilder $i" } at MainTest.main(test158.kt:10) test + +User code: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test158.MainTest", methodName = "main", fileName = "test158.kt", lineNumber = 10) + } + +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test159.kt:10) test + +User code: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test159.MainTest", methodName = "main", fileName = "test159.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at MainTest.main(test160.kt:10) test + +User code: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test160.MainTest", methodName = "main", fileName = "test160.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test161.kt:10) test + +User code: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test161.MainTest", methodName = "main", fileName = "test161.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test162.kt:10) test + +User code: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test162.MainTest", methodName = "main", fileName = "test162.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at MainTest.main(test163.kt:10) test + +User code: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test163.MainTest", methodName = "main", fileName = "test163.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test164.kt:10) test + +User code: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test164.MainTest", methodName = "main", fileName = "test164.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test165.kt:10) test + +User code: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test165.MainTest", methodName = "main", fileName = "test165.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at MainTest.main(test166.kt:10) test + +User code: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test166.MainTest", methodName = "main", fileName = "test166.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test167.kt:10) test + +User code: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test167.MainTest", methodName = "main", fileName = "test167.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test168.kt:10) test + +User code: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test168.MainTest", methodName = "main", fileName = "test168.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at MainTest.main(test169.kt:10) test + +User code: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test169.MainTest", methodName = "main", fileName = "test169.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at MainTest.main(test170.kt:10) test + +User code: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test170.MainTest", methodName = "main", fileName = "test170.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test171.kt:10) test + +User code: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test171.MainTest", methodName = "main", fileName = "test171.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at MainTest.main(test172.kt:10) test + +User code: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test172.MainTest", methodName = "main", fileName = "test172.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at MainTest.main(test176.kt:10) test + +User code: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test176.MainTest", methodName = "main", fileName = "test176.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test177.kt:10) test + +User code: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test177.MainTest", methodName = "main", fileName = "test177.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test178.kt:10) test + +User code: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test178.MainTest", methodName = "main", fileName = "test178.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at MainTest.main(test179.kt:10) test + +User code: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test179.MainTest", methodName = "main", fileName = "test179.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test180.kt:10) test + +User code: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test180.MainTest", methodName = "main", fileName = "test180.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test181.kt:10) test + +User code: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test181.MainTest", methodName = "main", fileName = "test181.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at MainTest.main(test182.kt:10) test + +User code: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test182.MainTest", methodName = "main", fileName = "test182.kt", lineNumber = 10) + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test183.kt:10) test + +User code: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test183.MainTest", methodName = "main", fileName = "test183.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test184.kt:10) test + +User code: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test184.MainTest", methodName = "main", fileName = "test184.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}") at MainTest.main(test188.kt:10) test + +User code: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") + } + +} +``` + +Transformed into: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test188.MainTest", methodName = "main", fileName = "test188.kt", lineNumber = 10) + } + +} +``` + +
+ +### info() { "info messageBuilder" } at MainTest.main(test189.kt:10) test + +User code: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test189.MainTest", methodName = "main", fileName = "test189.kt", lineNumber = 10) + } + +} +``` + +### info() { "info messageBuilder $i" } at MainTest.main(test190.kt:10) test + +User code: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test190.MainTest", methodName = "main", fileName = "test190.kt", lineNumber = 10) + } + +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at MainTest.main(test191.kt:10) test + +User code: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test191.MainTest", methodName = "main", fileName = "test191.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=null } at MainTest.main(test192.kt:10) test + +User code: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test192.MainTest", methodName = "main", fileName = "test192.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at MainTest.main(test193.kt:10) test + +User code: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test193.MainTest", methodName = "main", fileName = "test193.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test194.kt:10) test + +User code: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test194.MainTest", methodName = "main", fileName = "test194.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at MainTest.main(test195.kt:10) test + +User code: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test195.MainTest", methodName = "main", fileName = "test195.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at MainTest.main(test196.kt:10) test + +User code: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test196.MainTest", methodName = "main", fileName = "test196.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test197.kt:10) test + +User code: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test197.MainTest", methodName = "main", fileName = "test197.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at MainTest.main(test198.kt:10) test + +User code: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test198.MainTest", methodName = "main", fileName = "test198.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test199.kt:10) test + +User code: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test199.MainTest", methodName = "main", fileName = "test199.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test200.kt:10) test + +User code: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test200.MainTest", methodName = "main", fileName = "test200.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at MainTest.main(test201.kt:10) test + +User code: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test201.MainTest", methodName = "main", fileName = "test201.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at MainTest.main(test202.kt:10) test + +User code: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test202.MainTest", methodName = "main", fileName = "test202.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test203.kt:10) test + +User code: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test203.MainTest", methodName = "main", fileName = "test203.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at MainTest.main(test204.kt:10) test + +User code: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test204.MainTest", methodName = "main", fileName = "test204.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at MainTest.main(test205.kt:10) test + +User code: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test205.MainTest", methodName = "main", fileName = "test205.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at MainTest.main(test206.kt:10) test + +User code: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test206.MainTest", methodName = "main", fileName = "test206.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test207.kt:10) test + +User code: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test207.MainTest", methodName = "main", fileName = "test207.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test208.kt:10) test + +User code: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test208.MainTest", methodName = "main", fileName = "test208.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test209.kt:10) test + +User code: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test209.MainTest", methodName = "main", fileName = "test209.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test210.kt:10) test + +User code: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test210.MainTest", methodName = "main", fileName = "test210.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test211.kt:10) test + +User code: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test211.MainTest", methodName = "main", fileName = "test211.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test212.kt:10) test + +User code: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test212.MainTest", methodName = "main", fileName = "test212.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test213.kt:10) test + +User code: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test213.MainTest", methodName = "main", fileName = "test213.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at MainTest.main(test214.kt:10) test + +User code: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test214.MainTest", methodName = "main", fileName = "test214.kt", lineNumber = 10) + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test215.kt:10) test + +User code: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test215.MainTest", methodName = "main", fileName = "test215.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test216.kt:10) test + +User code: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test216.MainTest", methodName = "main", fileName = "test216.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}", throwable) at MainTest.main(test220.kt:10) test + +User code: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test220.MainTest", methodName = "main", fileName = "test220.kt", lineNumber = 10) + } + +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at MainTest.main(test221.kt:10) test + +User code: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test221.MainTest", methodName = "main", fileName = "test221.kt", lineNumber = 10) + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at MainTest.main(test222.kt:10) test + +User code: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test222.MainTest", methodName = "main", fileName = "test222.kt", lineNumber = 10) + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test223.kt:10) test + +User code: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test223.MainTest", methodName = "main", fileName = "test223.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at MainTest.main(test224.kt:10) test + +User code: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test224.MainTest", methodName = "main", fileName = "test224.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test225.kt:10) test + +User code: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test225.MainTest", methodName = "main", fileName = "test225.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test226.kt:10) test + +User code: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test226.MainTest", methodName = "main", fileName = "test226.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test227.kt:10) test + +User code: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test227.MainTest", methodName = "main", fileName = "test227.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test228.kt:10) test + +User code: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test228.MainTest", methodName = "main", fileName = "test228.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test229.kt:10) test + +User code: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test229.MainTest", methodName = "main", fileName = "test229.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at MainTest.main(test230.kt:10) test + +User code: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test230.MainTest", methodName = "main", fileName = "test230.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test231.kt:10) test + +User code: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test231.MainTest", methodName = "main", fileName = "test231.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test232.kt:10) test + +User code: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test232.MainTest", methodName = "main", fileName = "test232.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at MainTest.main(test233.kt:10) test + +User code: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test233.MainTest", methodName = "main", fileName = "test233.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at MainTest.main(test234.kt:10) test + +User code: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test234.MainTest", methodName = "main", fileName = "test234.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test235.kt:10) test + +User code: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test235.MainTest", methodName = "main", fileName = "test235.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at MainTest.main(test236.kt:10) test + +User code: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test236.MainTest", methodName = "main", fileName = "test236.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test240.kt:10) test + +User code: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test240.MainTest", methodName = "main", fileName = "test240.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test241.kt:10) test + +User code: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test241.MainTest", methodName = "main", fileName = "test241.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test242.kt:10) test + +User code: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test242.MainTest", methodName = "main", fileName = "test242.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test243.kt:10) test + +User code: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test243.MainTest", methodName = "main", fileName = "test243.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test244.kt:10) test + +User code: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test244.MainTest", methodName = "main", fileName = "test244.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test245.kt:10) test + +User code: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test245.MainTest", methodName = "main", fileName = "test245.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at MainTest.main(test246.kt:10) test + +User code: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test246.MainTest", methodName = "main", fileName = "test246.kt", lineNumber = 10) + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test247.kt:10) test + +User code: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test247.MainTest", methodName = "main", fileName = "test247.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test248.kt:10) test + +User code: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test248.MainTest", methodName = "main", fileName = "test248.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}") at MainTest.main(test252.kt:10) test + +User code: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") + } + +} +``` + +Transformed into: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test252.MainTest", methodName = "main", fileName = "test252.kt", lineNumber = 10) + } + +} +``` + +
+ +### warn() { "warn messageBuilder" } at MainTest.main(test253.kt:10) test + +User code: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test253.MainTest", methodName = "main", fileName = "test253.kt", lineNumber = 10) + } + +} +``` + +### warn() { "warn messageBuilder $i" } at MainTest.main(test254.kt:10) test + +User code: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test254.MainTest", methodName = "main", fileName = "test254.kt", lineNumber = 10) + } + +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at MainTest.main(test255.kt:10) test + +User code: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test255.MainTest", methodName = "main", fileName = "test255.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at MainTest.main(test256.kt:10) test + +User code: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test256.MainTest", methodName = "main", fileName = "test256.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at MainTest.main(test257.kt:10) test + +User code: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test257.MainTest", methodName = "main", fileName = "test257.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test258.kt:10) test + +User code: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test258.MainTest", methodName = "main", fileName = "test258.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at MainTest.main(test259.kt:10) test + +User code: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test259.MainTest", methodName = "main", fileName = "test259.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test260.kt:10) test + +User code: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test260.MainTest", methodName = "main", fileName = "test260.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test261.kt:10) test + +User code: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test261.MainTest", methodName = "main", fileName = "test261.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at MainTest.main(test262.kt:10) test + +User code: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test262.MainTest", methodName = "main", fileName = "test262.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test263.kt:10) test + +User code: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test263.MainTest", methodName = "main", fileName = "test263.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test264.kt:10) test + +User code: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test264.MainTest", methodName = "main", fileName = "test264.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at MainTest.main(test265.kt:10) test + +User code: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test265.MainTest", methodName = "main", fileName = "test265.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at MainTest.main(test266.kt:10) test + +User code: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test266.MainTest", methodName = "main", fileName = "test266.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test267.kt:10) test + +User code: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test267.MainTest", methodName = "main", fileName = "test267.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at MainTest.main(test268.kt:10) test + +User code: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test268.MainTest", methodName = "main", fileName = "test268.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at MainTest.main(test269.kt:10) test + +User code: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test269.MainTest", methodName = "main", fileName = "test269.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at MainTest.main(test270.kt:10) test + +User code: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test270.MainTest", methodName = "main", fileName = "test270.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test271.kt:10) test + +User code: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test271.MainTest", methodName = "main", fileName = "test271.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test272.kt:10) test + +User code: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test272.MainTest", methodName = "main", fileName = "test272.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test273.kt:10) test + +User code: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test273.MainTest", methodName = "main", fileName = "test273.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test274.kt:10) test + +User code: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test274.MainTest", methodName = "main", fileName = "test274.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test275.kt:10) test + +User code: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test275.MainTest", methodName = "main", fileName = "test275.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test276.kt:10) test + +User code: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test276.MainTest", methodName = "main", fileName = "test276.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test277.kt:10) test + +User code: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test277.MainTest", methodName = "main", fileName = "test277.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at MainTest.main(test278.kt:10) test + +User code: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test278.MainTest", methodName = "main", fileName = "test278.kt", lineNumber = 10) + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test279.kt:10) test + +User code: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test279.MainTest", methodName = "main", fileName = "test279.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test280.kt:10) test + +User code: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test280.MainTest", methodName = "main", fileName = "test280.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}", throwable) at MainTest.main(test284.kt:10) test + +User code: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test284.MainTest", methodName = "main", fileName = "test284.kt", lineNumber = 10) + } + +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at MainTest.main(test285.kt:10) test + +User code: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test285.MainTest", methodName = "main", fileName = "test285.kt", lineNumber = 10) + } + +} +``` + +### error(throwable) { "error messageBuilder $i" } at MainTest.main(test286.kt:10) test + +User code: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test286.MainTest", methodName = "main", fileName = "test286.kt", lineNumber = 10) + } + +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test287.kt:10) test + +User code: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test287.MainTest", methodName = "main", fileName = "test287.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=throwable } at MainTest.main(test288.kt:10) test + +User code: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test288.MainTest", methodName = "main", fileName = "test288.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test289.kt:10) test + +User code: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test289.MainTest", methodName = "main", fileName = "test289.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test290.kt:10) test + +User code: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test290.MainTest", methodName = "main", fileName = "test290.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at MainTest.main(test291.kt:10) test + +User code: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test291.MainTest", methodName = "main", fileName = "test291.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test292.kt:10) test + +User code: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test292.MainTest", methodName = "main", fileName = "test292.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test293.kt:10) test + +User code: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test293.MainTest", methodName = "main", fileName = "test293.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at MainTest.main(test294.kt:10) test + +User code: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test294.MainTest", methodName = "main", fileName = "test294.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test295.kt:10) test + +User code: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test295.MainTest", methodName = "main", fileName = "test295.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test296.kt:10) test + +User code: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test296.MainTest", methodName = "main", fileName = "test296.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at MainTest.main(test297.kt:10) test + +User code: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test297.MainTest", methodName = "main", fileName = "test297.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at MainTest.main(test298.kt:10) test + +User code: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test298.MainTest", methodName = "main", fileName = "test298.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test299.kt:10) test + +User code: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test299.MainTest", methodName = "main", fileName = "test299.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at MainTest.main(test300.kt:10) test + +User code: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test300.MainTest", methodName = "main", fileName = "test300.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at MainTest.main(test304.kt:10) test + +User code: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test304.MainTest", methodName = "main", fileName = "test304.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test305.kt:10) test + +User code: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test305.MainTest", methodName = "main", fileName = "test305.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test306.kt:10) test + +User code: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test306.MainTest", methodName = "main", fileName = "test306.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at MainTest.main(test307.kt:10) test + +User code: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test307.MainTest", methodName = "main", fileName = "test307.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test308.kt:10) test + +User code: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test308.MainTest", methodName = "main", fileName = "test308.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test309.kt:10) test + +User code: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test309.MainTest", methodName = "main", fileName = "test309.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at MainTest.main(test310.kt:10) test + +User code: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test310.MainTest", methodName = "main", fileName = "test310.kt", lineNumber = 10) + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test311.kt:10) test + +User code: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test311.MainTest", methodName = "main", fileName = "test311.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test312.kt:10) test + +User code: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test312.MainTest", methodName = "main", fileName = "test312.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}") at MainTest.main(test316.kt:10) test + +User code: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") + } + +} +``` + +Transformed into: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test316.MainTest", methodName = "main", fileName = "test316.kt", lineNumber = 10) + } + +} +``` + +
+ +### error() { "error messageBuilder" } at MainTest.main(test317.kt:10) test + +User code: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test317.MainTest", methodName = "main", fileName = "test317.kt", lineNumber = 10) + } + +} +``` + +### error() { "error messageBuilder $i" } at MainTest.main(test318.kt:10) test + +User code: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test318.MainTest", methodName = "main", fileName = "test318.kt", lineNumber = 10) + } + +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at MainTest.main(test319.kt:10) test + +User code: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test319.MainTest", methodName = "main", fileName = "test319.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=null } at MainTest.main(test320.kt:10) test + +User code: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test320.MainTest", methodName = "main", fileName = "test320.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at MainTest.main(test321.kt:10) test + +User code: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test321.MainTest", methodName = "main", fileName = "test321.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test322.kt:10) test + +User code: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test322.MainTest", methodName = "main", fileName = "test322.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at MainTest.main(test323.kt:10) test + +User code: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test323.MainTest", methodName = "main", fileName = "test323.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at MainTest.main(test324.kt:10) test + +User code: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test324.MainTest", methodName = "main", fileName = "test324.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test325.kt:10) test + +User code: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test325.MainTest", methodName = "main", fileName = "test325.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
+ +
with class=false + +
entry/exit API + +### entry(argument1, argument2) at Test326Kt.main(test326.kt:10) test + +User code: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) +} +``` + +Remains as-is: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) +} +``` + +### exit(resultValue) at Test327Kt.main(test327.kt:10) test + +User code: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) +} +``` + +Remains as-is: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) +} +``` + +### exit() at Test328Kt.main(test328.kt:10) test + +User code: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() +} +``` + +Remains as-is: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at Test329Kt.main(test329.kt:10) test + +User code: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) +} +``` + +Transformed into: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "throwing(throwable)", className = "test329.Test329Kt", methodName = "main", fileName = "test329.kt", lineNumber = 10), throwable) +} +``` + +### catching(throwable) at Test330Kt.main(test330.kt:10) test + +User code: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) +} +``` + +Transformed into: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catchingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "catching(throwable)", className = "test330.Test330Kt", methodName = "main", fileName = "test330.kt", lineNumber = 10), throwable) +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at Test331Kt.main(test331.kt:10) test + +User code: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test331.Test331Kt", methodName = "main", fileName = "test331.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test332Kt.main(test332.kt:10) test + +User code: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test332.Test332Kt", methodName = "main", fileName = "test332.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test333Kt.main(test333.kt:10) test + +User code: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test333.Test333Kt", methodName = "main", fileName = "test333.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at Test334Kt.main(test334.kt:10) test + +User code: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test334.Test334Kt", methodName = "main", fileName = "test334.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at Test335Kt.main(test335.kt:10) test + +User code: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test335.Test335Kt", methodName = "main", fileName = "test335.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at Test336Kt.main(test336.kt:10) test + +User code: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test336.Test336Kt", methodName = "main", fileName = "test336.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at Test337Kt.main(test337.kt:10) test + +User code: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test337.Test337Kt", methodName = "main", fileName = "test337.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at Test338Kt.main(test338.kt:10) test + +User code: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test338.Test338Kt", methodName = "main", fileName = "test338.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at Test339Kt.main(test339.kt:10) test + +User code: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test339.Test339Kt", methodName = "main", fileName = "test339.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at Test340Kt.main(test340.kt:10) test + +User code: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test340.Test340Kt", methodName = "main", fileName = "test340.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at Test341Kt.main(test341.kt:10) test + +User code: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test341.Test341Kt", methodName = "main", fileName = "test341.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at Test342Kt.main(test342.kt:10) test + +User code: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test342.Test342Kt", methodName = "main", fileName = "test342.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test343Kt.main(test343.kt:10) test + +User code: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test343.Test343Kt", methodName = "main", fileName = "test343.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at Test344Kt.main(test344.kt:10) test + +User code: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test344.Test344Kt", methodName = "main", fileName = "test344.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at Test345Kt.main(test345.kt:10) test + +User code: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test345.Test345Kt", methodName = "main", fileName = "test345.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test346Kt.main(test346.kt:10) test + +User code: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test346.Test346Kt", methodName = "main", fileName = "test346.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at Test347Kt.main(test347.kt:10) test + +User code: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test347.Test347Kt", methodName = "main", fileName = "test347.kt", lineNumber = 10) +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test348Kt.main(test348.kt:10) test + +User code: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test348.Test348Kt", methodName = "main", fileName = "test348.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test349Kt.main(test349.kt:10) test + +User code: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test349.Test349Kt", methodName = "main", fileName = "test349.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}", throwable) at Test353Kt.main(test353.kt:10) test + +User code: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test353.Test353Kt", methodName = "main", fileName = "test353.kt", lineNumber = 10) +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at Test354Kt.main(test354.kt:10) test + +User code: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test354.Test354Kt", methodName = "main", fileName = "test354.kt", lineNumber = 10) +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at Test355Kt.main(test355.kt:10) test + +User code: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test355.Test355Kt", methodName = "main", fileName = "test355.kt", lineNumber = 10) +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at Test356Kt.main(test356.kt:10) test + +User code: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test356.Test356Kt", methodName = "main", fileName = "test356.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at Test357Kt.main(test357.kt:10) test + +User code: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test357.Test357Kt", methodName = "main", fileName = "test357.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at Test358Kt.main(test358.kt:10) test + +User code: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test358.Test358Kt", methodName = "main", fileName = "test358.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test359Kt.main(test359.kt:10) test + +User code: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test359.Test359Kt", methodName = "main", fileName = "test359.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at Test360Kt.main(test360.kt:10) test + +User code: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test360.Test360Kt", methodName = "main", fileName = "test360.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at Test361Kt.main(test361.kt:10) test + +User code: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test361.Test361Kt", methodName = "main", fileName = "test361.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test362Kt.main(test362.kt:10) test + +User code: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test362.Test362Kt", methodName = "main", fileName = "test362.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at Test363Kt.main(test363.kt:10) test + +User code: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test363.Test363Kt", methodName = "main", fileName = "test363.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test364Kt.main(test364.kt:10) test + +User code: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test364.Test364Kt", methodName = "main", fileName = "test364.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test365Kt.main(test365.kt:10) test + +User code: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test365.Test365Kt", methodName = "main", fileName = "test365.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at Test366Kt.main(test366.kt:10) test + +User code: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test366.Test366Kt", methodName = "main", fileName = "test366.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at Test367Kt.main(test367.kt:10) test + +User code: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test367.Test367Kt", methodName = "main", fileName = "test367.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at Test368Kt.main(test368.kt:10) test + +User code: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test368.Test368Kt", methodName = "main", fileName = "test368.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at Test369Kt.main(test369.kt:10) test + +User code: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test369.Test369Kt", methodName = "main", fileName = "test369.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at Test373Kt.main(test373.kt:10) test + +User code: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test373.Test373Kt", methodName = "main", fileName = "test373.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at Test374Kt.main(test374.kt:10) test + +User code: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test374.Test374Kt", methodName = "main", fileName = "test374.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test375Kt.main(test375.kt:10) test + +User code: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test375.Test375Kt", methodName = "main", fileName = "test375.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at Test376Kt.main(test376.kt:10) test + +User code: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test376.Test376Kt", methodName = "main", fileName = "test376.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at Test377Kt.main(test377.kt:10) test + +User code: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test377.Test377Kt", methodName = "main", fileName = "test377.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test378Kt.main(test378.kt:10) test + +User code: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test378.Test378Kt", methodName = "main", fileName = "test378.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at Test379Kt.main(test379.kt:10) test + +User code: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) +} +``` + +Transformed into: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test379.Test379Kt", methodName = "main", fileName = "test379.kt", lineNumber = 10) +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test380Kt.main(test380.kt:10) test + +User code: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test380.Test380Kt", methodName = "main", fileName = "test380.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test381Kt.main(test381.kt:10) test + +User code: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test381.Test381Kt", methodName = "main", fileName = "test381.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}") at Test385Kt.main(test385.kt:10) test + +User code: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") +} +``` + +Transformed into: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test385.Test385Kt", methodName = "main", fileName = "test385.kt", lineNumber = 10) +} +``` + +
+ +### trace() { "trace messageBuilder" } at Test386Kt.main(test386.kt:10) test + +User code: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test386.Test386Kt", methodName = "main", fileName = "test386.kt", lineNumber = 10) +} +``` + +### trace() { "trace messageBuilder $i" } at Test387Kt.main(test387.kt:10) test + +User code: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test387.Test387Kt", methodName = "main", fileName = "test387.kt", lineNumber = 10) +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at Test388Kt.main(test388.kt:10) test + +User code: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test388.Test388Kt", methodName = "main", fileName = "test388.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at Test389Kt.main(test389.kt:10) test + +User code: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test389.Test389Kt", methodName = "main", fileName = "test389.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at Test390Kt.main(test390.kt:10) test + +User code: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test390.Test390Kt", methodName = "main", fileName = "test390.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at Test391Kt.main(test391.kt:10) test + +User code: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test391.Test391Kt", methodName = "main", fileName = "test391.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at Test392Kt.main(test392.kt:10) test + +User code: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test392.Test392Kt", methodName = "main", fileName = "test392.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at Test393Kt.main(test393.kt:10) test + +User code: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test393.Test393Kt", methodName = "main", fileName = "test393.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test394Kt.main(test394.kt:10) test + +User code: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test394.Test394Kt", methodName = "main", fileName = "test394.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at Test395Kt.main(test395.kt:10) test + +User code: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test395.Test395Kt", methodName = "main", fileName = "test395.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test396Kt.main(test396.kt:10) test + +User code: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test396.Test396Kt", methodName = "main", fileName = "test396.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test397Kt.main(test397.kt:10) test + +User code: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test397.Test397Kt", methodName = "main", fileName = "test397.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at Test398Kt.main(test398.kt:10) test + +User code: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test398.Test398Kt", methodName = "main", fileName = "test398.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at Test399Kt.main(test399.kt:10) test + +User code: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test399.Test399Kt", methodName = "main", fileName = "test399.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at Test400Kt.main(test400.kt:10) test + +User code: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test400.Test400Kt", methodName = "main", fileName = "test400.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at Test401Kt.main(test401.kt:10) test + +User code: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test401.Test401Kt", methodName = "main", fileName = "test401.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at Test402Kt.main(test402.kt:10) test + +User code: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test402.Test402Kt", methodName = "main", fileName = "test402.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at Test403Kt.main(test403.kt:10) test + +User code: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test403.Test403Kt", methodName = "main", fileName = "test403.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at Test404Kt.main(test404.kt:10) test + +User code: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test404.Test404Kt", methodName = "main", fileName = "test404.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at Test405Kt.main(test405.kt:10) test + +User code: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test405.Test405Kt", methodName = "main", fileName = "test405.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at Test406Kt.main(test406.kt:10) test + +User code: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test406.Test406Kt", methodName = "main", fileName = "test406.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test407Kt.main(test407.kt:10) test + +User code: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test407.Test407Kt", methodName = "main", fileName = "test407.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at Test408Kt.main(test408.kt:10) test + +User code: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test408.Test408Kt", methodName = "main", fileName = "test408.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at Test409Kt.main(test409.kt:10) test + +User code: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test409.Test409Kt", methodName = "main", fileName = "test409.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test410Kt.main(test410.kt:10) test + +User code: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test410.Test410Kt", methodName = "main", fileName = "test410.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at Test411Kt.main(test411.kt:10) test + +User code: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test411.Test411Kt", methodName = "main", fileName = "test411.kt", lineNumber = 10) +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test412Kt.main(test412.kt:10) test + +User code: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test412.Test412Kt", methodName = "main", fileName = "test412.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test413Kt.main(test413.kt:10) test + +User code: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test413.Test413Kt", methodName = "main", fileName = "test413.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}", throwable) at Test417Kt.main(test417.kt:10) test + +User code: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test417.Test417Kt", methodName = "main", fileName = "test417.kt", lineNumber = 10) +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at Test418Kt.main(test418.kt:10) test + +User code: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test418.Test418Kt", methodName = "main", fileName = "test418.kt", lineNumber = 10) +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at Test419Kt.main(test419.kt:10) test + +User code: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test419.Test419Kt", methodName = "main", fileName = "test419.kt", lineNumber = 10) +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at Test420Kt.main(test420.kt:10) test + +User code: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test420.Test420Kt", methodName = "main", fileName = "test420.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at Test421Kt.main(test421.kt:10) test + +User code: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test421.Test421Kt", methodName = "main", fileName = "test421.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at Test422Kt.main(test422.kt:10) test + +User code: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test422.Test422Kt", methodName = "main", fileName = "test422.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test423Kt.main(test423.kt:10) test + +User code: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test423.Test423Kt", methodName = "main", fileName = "test423.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at Test424Kt.main(test424.kt:10) test + +User code: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test424.Test424Kt", methodName = "main", fileName = "test424.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at Test425Kt.main(test425.kt:10) test + +User code: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test425.Test425Kt", methodName = "main", fileName = "test425.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test426Kt.main(test426.kt:10) test + +User code: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test426.Test426Kt", methodName = "main", fileName = "test426.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at Test427Kt.main(test427.kt:10) test + +User code: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test427.Test427Kt", methodName = "main", fileName = "test427.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test428Kt.main(test428.kt:10) test + +User code: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test428.Test428Kt", methodName = "main", fileName = "test428.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test429Kt.main(test429.kt:10) test + +User code: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test429.Test429Kt", methodName = "main", fileName = "test429.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at Test430Kt.main(test430.kt:10) test + +User code: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test430.Test430Kt", methodName = "main", fileName = "test430.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at Test431Kt.main(test431.kt:10) test + +User code: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test431.Test431Kt", methodName = "main", fileName = "test431.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at Test432Kt.main(test432.kt:10) test + +User code: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test432.Test432Kt", methodName = "main", fileName = "test432.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at Test433Kt.main(test433.kt:10) test + +User code: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test433.Test433Kt", methodName = "main", fileName = "test433.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at Test437Kt.main(test437.kt:10) test + +User code: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test437.Test437Kt", methodName = "main", fileName = "test437.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at Test438Kt.main(test438.kt:10) test + +User code: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test438.Test438Kt", methodName = "main", fileName = "test438.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test439Kt.main(test439.kt:10) test + +User code: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test439.Test439Kt", methodName = "main", fileName = "test439.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at Test440Kt.main(test440.kt:10) test + +User code: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test440.Test440Kt", methodName = "main", fileName = "test440.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at Test441Kt.main(test441.kt:10) test + +User code: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test441.Test441Kt", methodName = "main", fileName = "test441.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test442Kt.main(test442.kt:10) test + +User code: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test442.Test442Kt", methodName = "main", fileName = "test442.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at Test443Kt.main(test443.kt:10) test + +User code: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) +} +``` + +Transformed into: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test443.Test443Kt", methodName = "main", fileName = "test443.kt", lineNumber = 10) +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test444Kt.main(test444.kt:10) test + +User code: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test444.Test444Kt", methodName = "main", fileName = "test444.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test445Kt.main(test445.kt:10) test + +User code: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test445.Test445Kt", methodName = "main", fileName = "test445.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}") at Test449Kt.main(test449.kt:10) test + +User code: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") +} +``` + +Transformed into: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test449.Test449Kt", methodName = "main", fileName = "test449.kt", lineNumber = 10) +} +``` + +
+ +### debug() { "debug messageBuilder" } at Test450Kt.main(test450.kt:10) test + +User code: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test450.Test450Kt", methodName = "main", fileName = "test450.kt", lineNumber = 10) +} +``` + +### debug() { "debug messageBuilder $i" } at Test451Kt.main(test451.kt:10) test + +User code: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test451.Test451Kt", methodName = "main", fileName = "test451.kt", lineNumber = 10) +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at Test452Kt.main(test452.kt:10) test + +User code: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test452.Test452Kt", methodName = "main", fileName = "test452.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at Test453Kt.main(test453.kt:10) test + +User code: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test453.Test453Kt", methodName = "main", fileName = "test453.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at Test454Kt.main(test454.kt:10) test + +User code: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test454.Test454Kt", methodName = "main", fileName = "test454.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at Test455Kt.main(test455.kt:10) test + +User code: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test455.Test455Kt", methodName = "main", fileName = "test455.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at Test456Kt.main(test456.kt:10) test + +User code: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test456.Test456Kt", methodName = "main", fileName = "test456.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at Test457Kt.main(test457.kt:10) test + +User code: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test457.Test457Kt", methodName = "main", fileName = "test457.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test458Kt.main(test458.kt:10) test + +User code: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test458.Test458Kt", methodName = "main", fileName = "test458.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at Test459Kt.main(test459.kt:10) test + +User code: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test459.Test459Kt", methodName = "main", fileName = "test459.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test460Kt.main(test460.kt:10) test + +User code: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test460.Test460Kt", methodName = "main", fileName = "test460.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test461Kt.main(test461.kt:10) test + +User code: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test461.Test461Kt", methodName = "main", fileName = "test461.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at Test462Kt.main(test462.kt:10) test + +User code: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test462.Test462Kt", methodName = "main", fileName = "test462.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at Test463Kt.main(test463.kt:10) test + +User code: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test463.Test463Kt", methodName = "main", fileName = "test463.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at Test464Kt.main(test464.kt:10) test + +User code: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test464.Test464Kt", methodName = "main", fileName = "test464.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at Test465Kt.main(test465.kt:10) test + +User code: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test465.Test465Kt", methodName = "main", fileName = "test465.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at Test466Kt.main(test466.kt:10) test + +User code: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test466.Test466Kt", methodName = "main", fileName = "test466.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at Test467Kt.main(test467.kt:10) test + +User code: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test467.Test467Kt", methodName = "main", fileName = "test467.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at Test468Kt.main(test468.kt:10) test + +User code: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test468.Test468Kt", methodName = "main", fileName = "test468.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at Test469Kt.main(test469.kt:10) test + +User code: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test469.Test469Kt", methodName = "main", fileName = "test469.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at Test470Kt.main(test470.kt:10) test + +User code: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test470.Test470Kt", methodName = "main", fileName = "test470.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test471Kt.main(test471.kt:10) test + +User code: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test471.Test471Kt", methodName = "main", fileName = "test471.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at Test472Kt.main(test472.kt:10) test + +User code: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test472.Test472Kt", methodName = "main", fileName = "test472.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at Test473Kt.main(test473.kt:10) test + +User code: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test473.Test473Kt", methodName = "main", fileName = "test473.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test474Kt.main(test474.kt:10) test + +User code: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test474.Test474Kt", methodName = "main", fileName = "test474.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at Test475Kt.main(test475.kt:10) test + +User code: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test475.Test475Kt", methodName = "main", fileName = "test475.kt", lineNumber = 10) +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test476Kt.main(test476.kt:10) test + +User code: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test476.Test476Kt", methodName = "main", fileName = "test476.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test477Kt.main(test477.kt:10) test + +User code: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test477.Test477Kt", methodName = "main", fileName = "test477.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### info("info message {}", throwable) at Test481Kt.main(test481.kt:10) test + +User code: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test481.Test481Kt", methodName = "main", fileName = "test481.kt", lineNumber = 10) +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at Test482Kt.main(test482.kt:10) test + +User code: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test482.Test482Kt", methodName = "main", fileName = "test482.kt", lineNumber = 10) +} +``` + +### info(throwable) { "info messageBuilder $i" } at Test483Kt.main(test483.kt:10) test + +User code: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test483.Test483Kt", methodName = "main", fileName = "test483.kt", lineNumber = 10) +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at Test484Kt.main(test484.kt:10) test + +User code: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test484.Test484Kt", methodName = "main", fileName = "test484.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at Test485Kt.main(test485.kt:10) test + +User code: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test485.Test485Kt", methodName = "main", fileName = "test485.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at Test486Kt.main(test486.kt:10) test + +User code: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test486.Test486Kt", methodName = "main", fileName = "test486.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test487Kt.main(test487.kt:10) test + +User code: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test487.Test487Kt", methodName = "main", fileName = "test487.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at Test488Kt.main(test488.kt:10) test + +User code: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test488.Test488Kt", methodName = "main", fileName = "test488.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at Test489Kt.main(test489.kt:10) test + +User code: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test489.Test489Kt", methodName = "main", fileName = "test489.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test490Kt.main(test490.kt:10) test + +User code: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test490.Test490Kt", methodName = "main", fileName = "test490.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at Test491Kt.main(test491.kt:10) test + +User code: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test491.Test491Kt", methodName = "main", fileName = "test491.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test492Kt.main(test492.kt:10) test + +User code: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test492.Test492Kt", methodName = "main", fileName = "test492.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test493Kt.main(test493.kt:10) test + +User code: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test493.Test493Kt", methodName = "main", fileName = "test493.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at Test494Kt.main(test494.kt:10) test + +User code: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test494.Test494Kt", methodName = "main", fileName = "test494.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at Test495Kt.main(test495.kt:10) test + +User code: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test495.Test495Kt", methodName = "main", fileName = "test495.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at Test496Kt.main(test496.kt:10) test + +User code: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test496.Test496Kt", methodName = "main", fileName = "test496.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at Test497Kt.main(test497.kt:10) test + +User code: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test497.Test497Kt", methodName = "main", fileName = "test497.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at Test501Kt.main(test501.kt:10) test + +User code: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test501.Test501Kt", methodName = "main", fileName = "test501.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at Test502Kt.main(test502.kt:10) test + +User code: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test502.Test502Kt", methodName = "main", fileName = "test502.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test503Kt.main(test503.kt:10) test + +User code: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test503.Test503Kt", methodName = "main", fileName = "test503.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at Test504Kt.main(test504.kt:10) test + +User code: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test504.Test504Kt", methodName = "main", fileName = "test504.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at Test505Kt.main(test505.kt:10) test + +User code: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test505.Test505Kt", methodName = "main", fileName = "test505.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test506Kt.main(test506.kt:10) test + +User code: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test506.Test506Kt", methodName = "main", fileName = "test506.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at Test507Kt.main(test507.kt:10) test + +User code: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) +} +``` + +Transformed into: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test507.Test507Kt", methodName = "main", fileName = "test507.kt", lineNumber = 10) +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test508Kt.main(test508.kt:10) test + +User code: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test508.Test508Kt", methodName = "main", fileName = "test508.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test509Kt.main(test509.kt:10) test + +User code: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test509.Test509Kt", methodName = "main", fileName = "test509.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### info("info message {}") at Test513Kt.main(test513.kt:10) test + +User code: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") +} +``` + +Transformed into: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test513.Test513Kt", methodName = "main", fileName = "test513.kt", lineNumber = 10) +} +``` + +
+ +### info() { "info messageBuilder" } at Test514Kt.main(test514.kt:10) test + +User code: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test514.Test514Kt", methodName = "main", fileName = "test514.kt", lineNumber = 10) +} +``` + +### info() { "info messageBuilder $i" } at Test515Kt.main(test515.kt:10) test + +User code: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test515.Test515Kt", methodName = "main", fileName = "test515.kt", lineNumber = 10) +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at Test516Kt.main(test516.kt:10) test + +User code: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test516.Test516Kt", methodName = "main", fileName = "test516.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=null } at Test517Kt.main(test517.kt:10) test + +User code: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test517.Test517Kt", methodName = "main", fileName = "test517.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at Test518Kt.main(test518.kt:10) test + +User code: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test518.Test518Kt", methodName = "main", fileName = "test518.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at Test519Kt.main(test519.kt:10) test + +User code: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test519.Test519Kt", methodName = "main", fileName = "test519.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at Test520Kt.main(test520.kt:10) test + +User code: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test520.Test520Kt", methodName = "main", fileName = "test520.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at Test521Kt.main(test521.kt:10) test + +User code: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test521.Test521Kt", methodName = "main", fileName = "test521.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at Test522Kt.main(test522.kt:10) test + +User code: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test522.Test522Kt", methodName = "main", fileName = "test522.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at Test523Kt.main(test523.kt:10) test + +User code: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test523.Test523Kt", methodName = "main", fileName = "test523.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test524Kt.main(test524.kt:10) test + +User code: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test524.Test524Kt", methodName = "main", fileName = "test524.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test525Kt.main(test525.kt:10) test + +User code: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test525.Test525Kt", methodName = "main", fileName = "test525.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at Test526Kt.main(test526.kt:10) test + +User code: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test526.Test526Kt", methodName = "main", fileName = "test526.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at Test527Kt.main(test527.kt:10) test + +User code: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test527.Test527Kt", methodName = "main", fileName = "test527.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at Test528Kt.main(test528.kt:10) test + +User code: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test528.Test528Kt", methodName = "main", fileName = "test528.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at Test529Kt.main(test529.kt:10) test + +User code: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test529.Test529Kt", methodName = "main", fileName = "test529.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at Test530Kt.main(test530.kt:10) test + +User code: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test530.Test530Kt", methodName = "main", fileName = "test530.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at Test531Kt.main(test531.kt:10) test + +User code: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test531.Test531Kt", methodName = "main", fileName = "test531.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at Test532Kt.main(test532.kt:10) test + +User code: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test532.Test532Kt", methodName = "main", fileName = "test532.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at Test533Kt.main(test533.kt:10) test + +User code: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test533.Test533Kt", methodName = "main", fileName = "test533.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at Test534Kt.main(test534.kt:10) test + +User code: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test534.Test534Kt", methodName = "main", fileName = "test534.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test535Kt.main(test535.kt:10) test + +User code: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test535.Test535Kt", methodName = "main", fileName = "test535.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at Test536Kt.main(test536.kt:10) test + +User code: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test536.Test536Kt", methodName = "main", fileName = "test536.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at Test537Kt.main(test537.kt:10) test + +User code: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test537.Test537Kt", methodName = "main", fileName = "test537.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test538Kt.main(test538.kt:10) test + +User code: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test538.Test538Kt", methodName = "main", fileName = "test538.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at Test539Kt.main(test539.kt:10) test + +User code: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test539.Test539Kt", methodName = "main", fileName = "test539.kt", lineNumber = 10) +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test540Kt.main(test540.kt:10) test + +User code: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test540.Test540Kt", methodName = "main", fileName = "test540.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test541Kt.main(test541.kt:10) test + +User code: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test541.Test541Kt", methodName = "main", fileName = "test541.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}", throwable) at Test545Kt.main(test545.kt:10) test + +User code: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test545.Test545Kt", methodName = "main", fileName = "test545.kt", lineNumber = 10) +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at Test546Kt.main(test546.kt:10) test + +User code: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test546.Test546Kt", methodName = "main", fileName = "test546.kt", lineNumber = 10) +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at Test547Kt.main(test547.kt:10) test + +User code: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test547.Test547Kt", methodName = "main", fileName = "test547.kt", lineNumber = 10) +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at Test548Kt.main(test548.kt:10) test + +User code: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test548.Test548Kt", methodName = "main", fileName = "test548.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at Test549Kt.main(test549.kt:10) test + +User code: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test549.Test549Kt", methodName = "main", fileName = "test549.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at Test550Kt.main(test550.kt:10) test + +User code: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test550.Test550Kt", methodName = "main", fileName = "test550.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test551Kt.main(test551.kt:10) test + +User code: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test551.Test551Kt", methodName = "main", fileName = "test551.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at Test552Kt.main(test552.kt:10) test + +User code: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test552.Test552Kt", methodName = "main", fileName = "test552.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at Test553Kt.main(test553.kt:10) test + +User code: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test553.Test553Kt", methodName = "main", fileName = "test553.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test554Kt.main(test554.kt:10) test + +User code: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test554.Test554Kt", methodName = "main", fileName = "test554.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at Test555Kt.main(test555.kt:10) test + +User code: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test555.Test555Kt", methodName = "main", fileName = "test555.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test556Kt.main(test556.kt:10) test + +User code: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test556.Test556Kt", methodName = "main", fileName = "test556.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test557Kt.main(test557.kt:10) test + +User code: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test557.Test557Kt", methodName = "main", fileName = "test557.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at Test558Kt.main(test558.kt:10) test + +User code: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test558.Test558Kt", methodName = "main", fileName = "test558.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at Test559Kt.main(test559.kt:10) test + +User code: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test559.Test559Kt", methodName = "main", fileName = "test559.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at Test560Kt.main(test560.kt:10) test + +User code: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test560.Test560Kt", methodName = "main", fileName = "test560.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at Test561Kt.main(test561.kt:10) test + +User code: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test561.Test561Kt", methodName = "main", fileName = "test561.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at Test565Kt.main(test565.kt:10) test + +User code: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test565.Test565Kt", methodName = "main", fileName = "test565.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at Test566Kt.main(test566.kt:10) test + +User code: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test566.Test566Kt", methodName = "main", fileName = "test566.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test567Kt.main(test567.kt:10) test + +User code: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test567.Test567Kt", methodName = "main", fileName = "test567.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at Test568Kt.main(test568.kt:10) test + +User code: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test568.Test568Kt", methodName = "main", fileName = "test568.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at Test569Kt.main(test569.kt:10) test + +User code: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test569.Test569Kt", methodName = "main", fileName = "test569.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test570Kt.main(test570.kt:10) test + +User code: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test570.Test570Kt", methodName = "main", fileName = "test570.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at Test571Kt.main(test571.kt:10) test + +User code: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) +} +``` + +Transformed into: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test571.Test571Kt", methodName = "main", fileName = "test571.kt", lineNumber = 10) +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test572Kt.main(test572.kt:10) test + +User code: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test572.Test572Kt", methodName = "main", fileName = "test572.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test573Kt.main(test573.kt:10) test + +User code: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test573.Test573Kt", methodName = "main", fileName = "test573.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}") at Test577Kt.main(test577.kt:10) test + +User code: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") +} +``` + +Transformed into: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test577.Test577Kt", methodName = "main", fileName = "test577.kt", lineNumber = 10) +} +``` + +
+ +### warn() { "warn messageBuilder" } at Test578Kt.main(test578.kt:10) test + +User code: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test578.Test578Kt", methodName = "main", fileName = "test578.kt", lineNumber = 10) +} +``` + +### warn() { "warn messageBuilder $i" } at Test579Kt.main(test579.kt:10) test + +User code: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test579.Test579Kt", methodName = "main", fileName = "test579.kt", lineNumber = 10) +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at Test580Kt.main(test580.kt:10) test + +User code: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test580.Test580Kt", methodName = "main", fileName = "test580.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at Test581Kt.main(test581.kt:10) test + +User code: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test581.Test581Kt", methodName = "main", fileName = "test581.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at Test582Kt.main(test582.kt:10) test + +User code: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test582.Test582Kt", methodName = "main", fileName = "test582.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at Test583Kt.main(test583.kt:10) test + +User code: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test583.Test583Kt", methodName = "main", fileName = "test583.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at Test584Kt.main(test584.kt:10) test + +User code: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test584.Test584Kt", methodName = "main", fileName = "test584.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at Test585Kt.main(test585.kt:10) test + +User code: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test585.Test585Kt", methodName = "main", fileName = "test585.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test586Kt.main(test586.kt:10) test + +User code: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test586.Test586Kt", methodName = "main", fileName = "test586.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at Test587Kt.main(test587.kt:10) test + +User code: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test587.Test587Kt", methodName = "main", fileName = "test587.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test588Kt.main(test588.kt:10) test + +User code: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test588.Test588Kt", methodName = "main", fileName = "test588.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test589Kt.main(test589.kt:10) test + +User code: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test589.Test589Kt", methodName = "main", fileName = "test589.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at Test590Kt.main(test590.kt:10) test + +User code: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test590.Test590Kt", methodName = "main", fileName = "test590.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at Test591Kt.main(test591.kt:10) test + +User code: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test591.Test591Kt", methodName = "main", fileName = "test591.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at Test592Kt.main(test592.kt:10) test + +User code: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test592.Test592Kt", methodName = "main", fileName = "test592.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at Test593Kt.main(test593.kt:10) test + +User code: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test593.Test593Kt", methodName = "main", fileName = "test593.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at Test594Kt.main(test594.kt:10) test + +User code: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test594.Test594Kt", methodName = "main", fileName = "test594.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at Test595Kt.main(test595.kt:10) test + +User code: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test595.Test595Kt", methodName = "main", fileName = "test595.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at Test596Kt.main(test596.kt:10) test + +User code: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test596.Test596Kt", methodName = "main", fileName = "test596.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at Test597Kt.main(test597.kt:10) test + +User code: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test597.Test597Kt", methodName = "main", fileName = "test597.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at Test598Kt.main(test598.kt:10) test + +User code: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test598.Test598Kt", methodName = "main", fileName = "test598.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test599Kt.main(test599.kt:10) test + +User code: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test599.Test599Kt", methodName = "main", fileName = "test599.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at Test600Kt.main(test600.kt:10) test + +User code: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test600.Test600Kt", methodName = "main", fileName = "test600.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at Test601Kt.main(test601.kt:10) test + +User code: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test601.Test601Kt", methodName = "main", fileName = "test601.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test602Kt.main(test602.kt:10) test + +User code: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test602.Test602Kt", methodName = "main", fileName = "test602.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at Test603Kt.main(test603.kt:10) test + +User code: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test603.Test603Kt", methodName = "main", fileName = "test603.kt", lineNumber = 10) +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test604Kt.main(test604.kt:10) test + +User code: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test604.Test604Kt", methodName = "main", fileName = "test604.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test605Kt.main(test605.kt:10) test + +User code: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test605.Test605Kt", methodName = "main", fileName = "test605.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### error("error message {}", throwable) at Test609Kt.main(test609.kt:10) test + +User code: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test609.Test609Kt", methodName = "main", fileName = "test609.kt", lineNumber = 10) +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at Test610Kt.main(test610.kt:10) test + +User code: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test610.Test610Kt", methodName = "main", fileName = "test610.kt", lineNumber = 10) +} +``` + +### error(throwable) { "error messageBuilder $i" } at Test611Kt.main(test611.kt:10) test + +User code: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test611.Test611Kt", methodName = "main", fileName = "test611.kt", lineNumber = 10) +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at Test612Kt.main(test612.kt:10) test + +User code: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test612.Test612Kt", methodName = "main", fileName = "test612.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=throwable } at Test613Kt.main(test613.kt:10) test + +User code: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test613.Test613Kt", methodName = "main", fileName = "test613.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at Test614Kt.main(test614.kt:10) test + +User code: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test614.Test614Kt", methodName = "main", fileName = "test614.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test615Kt.main(test615.kt:10) test + +User code: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test615.Test615Kt", methodName = "main", fileName = "test615.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at Test616Kt.main(test616.kt:10) test + +User code: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test616.Test616Kt", methodName = "main", fileName = "test616.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at Test617Kt.main(test617.kt:10) test + +User code: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test617.Test617Kt", methodName = "main", fileName = "test617.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test618Kt.main(test618.kt:10) test + +User code: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test618.Test618Kt", methodName = "main", fileName = "test618.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at Test619Kt.main(test619.kt:10) test + +User code: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test619.Test619Kt", methodName = "main", fileName = "test619.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test620Kt.main(test620.kt:10) test + +User code: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test620.Test620Kt", methodName = "main", fileName = "test620.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test621Kt.main(test621.kt:10) test + +User code: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test621.Test621Kt", methodName = "main", fileName = "test621.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at Test622Kt.main(test622.kt:10) test + +User code: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test622.Test622Kt", methodName = "main", fileName = "test622.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at Test623Kt.main(test623.kt:10) test + +User code: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test623.Test623Kt", methodName = "main", fileName = "test623.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at Test624Kt.main(test624.kt:10) test + +User code: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test624.Test624Kt", methodName = "main", fileName = "test624.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at Test625Kt.main(test625.kt:10) test + +User code: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test625.Test625Kt", methodName = "main", fileName = "test625.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at Test629Kt.main(test629.kt:10) test + +User code: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test629.Test629Kt", methodName = "main", fileName = "test629.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at Test630Kt.main(test630.kt:10) test + +User code: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test630.Test630Kt", methodName = "main", fileName = "test630.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test631Kt.main(test631.kt:10) test + +User code: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test631.Test631Kt", methodName = "main", fileName = "test631.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at Test632Kt.main(test632.kt:10) test + +User code: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test632.Test632Kt", methodName = "main", fileName = "test632.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at Test633Kt.main(test633.kt:10) test + +User code: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test633.Test633Kt", methodName = "main", fileName = "test633.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test634Kt.main(test634.kt:10) test + +User code: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test634.Test634Kt", methodName = "main", fileName = "test634.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at Test635Kt.main(test635.kt:10) test + +User code: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) +} +``` + +Transformed into: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test635.Test635Kt", methodName = "main", fileName = "test635.kt", lineNumber = 10) +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test636Kt.main(test636.kt:10) test + +User code: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test636.Test636Kt", methodName = "main", fileName = "test636.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test637Kt.main(test637.kt:10) test + +User code: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test637.Test637Kt", methodName = "main", fileName = "test637.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### error("error message {}") at Test641Kt.main(test641.kt:10) test + +User code: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") +} +``` + +Transformed into: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test641.Test641Kt", methodName = "main", fileName = "test641.kt", lineNumber = 10) +} +``` + +
+ +### error() { "error messageBuilder" } at Test642Kt.main(test642.kt:10) test + +User code: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test642.Test642Kt", methodName = "main", fileName = "test642.kt", lineNumber = 10) +} +``` + +### error() { "error messageBuilder $i" } at Test643Kt.main(test643.kt:10) test + +User code: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test643.Test643Kt", methodName = "main", fileName = "test643.kt", lineNumber = 10) +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at Test644Kt.main(test644.kt:10) test + +User code: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test644.Test644Kt", methodName = "main", fileName = "test644.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=null } at Test645Kt.main(test645.kt:10) test + +User code: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test645.Test645Kt", methodName = "main", fileName = "test645.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at Test646Kt.main(test646.kt:10) test + +User code: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test646.Test646Kt", methodName = "main", fileName = "test646.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at Test647Kt.main(test647.kt:10) test + +User code: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test647.Test647Kt", methodName = "main", fileName = "test647.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at Test648Kt.main(test648.kt:10) test + +User code: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test648.Test648Kt", methodName = "main", fileName = "test648.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at Test649Kt.main(test649.kt:10) test + +User code: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test649.Test649Kt", methodName = "main", fileName = "test649.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at Test650Kt.main(test650.kt:10) test + +User code: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test650.Test650Kt", methodName = "main", fileName = "test650.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
+ +
featureFlag=DISABLE_TRANSFORMING_THROWING_CATCHING_API + +
with class=true + +
entry/exit API + +### entry(argument1, argument2) at MainTest.main(test1.kt:10) test + +User code: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) + } + +} +``` + +Transformed into: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entryWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "entry(argument1, argument2)", className = "test1.MainTest", methodName = "main", fileName = "test1.kt", lineNumber = 10)) + } + +} +``` + +### exit(resultValue) at MainTest.main(test2.kt:10) test + +User code: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) + } + +} +``` + +Transformed into: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "exit(resultValue)", className = "test2.MainTest", methodName = "main", fileName = "test2.kt", lineNumber = 10)) + } + +} +``` + +### exit() at MainTest.main(test3.kt:10) test + +User code: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() + } + +} +``` + +Transformed into: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(className = "test3.MainTest", methodName = "main", fileName = "test3.kt", lineNumber = 10)) + } + +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at MainTest.main(test4.kt:10) test + +User code: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) + } + +} +``` + +### catching(throwable) at MainTest.main(test5.kt:10) test + +User code: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) + } + +} +``` + +Remains as-is: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) + } + +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at MainTest.main(test6.kt:10) test + +User code: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test6.MainTest", methodName = "main", fileName = "test6.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test7.kt:10) test + +User code: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test7.MainTest", methodName = "main", fileName = "test7.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test8.kt:10) test + +User code: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test8.MainTest", methodName = "main", fileName = "test8.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at MainTest.main(test9.kt:10) test + +User code: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test9.MainTest", methodName = "main", fileName = "test9.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at MainTest.main(test10.kt:10) test + +User code: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test10.MainTest", methodName = "main", fileName = "test10.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test11.kt:10) test + +User code: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test11.MainTest", methodName = "main", fileName = "test11.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at MainTest.main(test12.kt:10) test + +User code: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test12.MainTest", methodName = "main", fileName = "test12.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at MainTest.main(test13.kt:10) test + +User code: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test13.MainTest", methodName = "main", fileName = "test13.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at MainTest.main(test14.kt:10) test + +User code: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test14.MainTest", methodName = "main", fileName = "test14.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test15.kt:10) test + +User code: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test15.MainTest", methodName = "main", fileName = "test15.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test16.kt:10) test + +User code: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test16.MainTest", methodName = "main", fileName = "test16.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test17.kt:10) test + +User code: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test17.MainTest", methodName = "main", fileName = "test17.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test18.kt:10) test + +User code: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test18.MainTest", methodName = "main", fileName = "test18.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test19.kt:10) test + +User code: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test19.MainTest", methodName = "main", fileName = "test19.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test20.kt:10) test + +User code: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test20.MainTest", methodName = "main", fileName = "test20.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test21.kt:10) test + +User code: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test21.MainTest", methodName = "main", fileName = "test21.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at MainTest.main(test22.kt:10) test + +User code: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test22.MainTest", methodName = "main", fileName = "test22.kt", lineNumber = 10) + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test23.kt:10) test + +User code: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test23.MainTest", methodName = "main", fileName = "test23.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test24.kt:10) test + +User code: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test24.MainTest", methodName = "main", fileName = "test24.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}", throwable) at MainTest.main(test28.kt:10) test + +User code: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test28.MainTest", methodName = "main", fileName = "test28.kt", lineNumber = 10) + } + +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at MainTest.main(test29.kt:10) test + +User code: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test29.MainTest", methodName = "main", fileName = "test29.kt", lineNumber = 10) + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at MainTest.main(test30.kt:10) test + +User code: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test30.MainTest", methodName = "main", fileName = "test30.kt", lineNumber = 10) + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test31.kt:10) test + +User code: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test31.MainTest", methodName = "main", fileName = "test31.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at MainTest.main(test32.kt:10) test + +User code: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test32.MainTest", methodName = "main", fileName = "test32.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test33.kt:10) test + +User code: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test33.MainTest", methodName = "main", fileName = "test33.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test34.kt:10) test + +User code: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test34.MainTest", methodName = "main", fileName = "test34.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test35.kt:10) test + +User code: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test35.MainTest", methodName = "main", fileName = "test35.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test36.kt:10) test + +User code: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test36.MainTest", methodName = "main", fileName = "test36.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test37.kt:10) test + +User code: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test37.MainTest", methodName = "main", fileName = "test37.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at MainTest.main(test38.kt:10) test + +User code: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test38.MainTest", methodName = "main", fileName = "test38.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test39.kt:10) test + +User code: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test39.MainTest", methodName = "main", fileName = "test39.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test40.kt:10) test + +User code: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test40.MainTest", methodName = "main", fileName = "test40.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at MainTest.main(test41.kt:10) test + +User code: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test41.MainTest", methodName = "main", fileName = "test41.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at MainTest.main(test42.kt:10) test + +User code: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test42.MainTest", methodName = "main", fileName = "test42.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test43.kt:10) test + +User code: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test43.MainTest", methodName = "main", fileName = "test43.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at MainTest.main(test44.kt:10) test + +User code: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test44.MainTest", methodName = "main", fileName = "test44.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test48.kt:10) test + +User code: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test48.MainTest", methodName = "main", fileName = "test48.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test49.kt:10) test + +User code: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test49.MainTest", methodName = "main", fileName = "test49.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test50.kt:10) test + +User code: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test50.MainTest", methodName = "main", fileName = "test50.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test51.kt:10) test + +User code: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test51.MainTest", methodName = "main", fileName = "test51.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test52.kt:10) test + +User code: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test52.MainTest", methodName = "main", fileName = "test52.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test53.kt:10) test + +User code: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test53.MainTest", methodName = "main", fileName = "test53.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at MainTest.main(test54.kt:10) test + +User code: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test54.MainTest", methodName = "main", fileName = "test54.kt", lineNumber = 10) + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test55.kt:10) test + +User code: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test55.MainTest", methodName = "main", fileName = "test55.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test56.kt:10) test + +User code: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test56.MainTest", methodName = "main", fileName = "test56.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}") at MainTest.main(test60.kt:10) test + +User code: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") + } + +} +``` + +Transformed into: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test60.MainTest", methodName = "main", fileName = "test60.kt", lineNumber = 10) + } + +} +``` + +
+ +### trace() { "trace messageBuilder" } at MainTest.main(test61.kt:10) test + +User code: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test61.MainTest", methodName = "main", fileName = "test61.kt", lineNumber = 10) + } + +} +``` + +### trace() { "trace messageBuilder $i" } at MainTest.main(test62.kt:10) test + +User code: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test62.MainTest", methodName = "main", fileName = "test62.kt", lineNumber = 10) + } + +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at MainTest.main(test63.kt:10) test + +User code: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test63.MainTest", methodName = "main", fileName = "test63.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at MainTest.main(test64.kt:10) test + +User code: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test64.MainTest", methodName = "main", fileName = "test64.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at MainTest.main(test65.kt:10) test + +User code: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test65.MainTest", methodName = "main", fileName = "test65.kt", lineNumber = 10) + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test66.kt:10) test + +User code: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test66.MainTest", methodName = "main", fileName = "test66.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at MainTest.main(test67.kt:10) test + +User code: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test67.MainTest", methodName = "main", fileName = "test67.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test68.kt:10) test + +User code: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test68.MainTest", methodName = "main", fileName = "test68.kt", lineNumber = 10) + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test69.kt:10) test + +User code: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test69.MainTest", methodName = "main", fileName = "test69.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at MainTest.main(test70.kt:10) test + +User code: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test70.MainTest", methodName = "main", fileName = "test70.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test71.kt:10) test + +User code: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test71.MainTest", methodName = "main", fileName = "test71.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test72.kt:10) test + +User code: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test72.MainTest", methodName = "main", fileName = "test72.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at MainTest.main(test73.kt:10) test + +User code: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test73.MainTest", methodName = "main", fileName = "test73.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at MainTest.main(test74.kt:10) test + +User code: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test74.MainTest", methodName = "main", fileName = "test74.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test75.kt:10) test + +User code: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test75.MainTest", methodName = "main", fileName = "test75.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at MainTest.main(test76.kt:10) test + +User code: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test76.MainTest", methodName = "main", fileName = "test76.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at MainTest.main(test77.kt:10) test + +User code: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test77.MainTest", methodName = "main", fileName = "test77.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at MainTest.main(test78.kt:10) test + +User code: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test78.MainTest", methodName = "main", fileName = "test78.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test79.kt:10) test + +User code: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test79.MainTest", methodName = "main", fileName = "test79.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test80.kt:10) test + +User code: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test80.MainTest", methodName = "main", fileName = "test80.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test81.kt:10) test + +User code: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test81.MainTest", methodName = "main", fileName = "test81.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test82.kt:10) test + +User code: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test82.MainTest", methodName = "main", fileName = "test82.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test83.kt:10) test + +User code: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test83.MainTest", methodName = "main", fileName = "test83.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test84.kt:10) test + +User code: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test84.MainTest", methodName = "main", fileName = "test84.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test85.kt:10) test + +User code: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test85.MainTest", methodName = "main", fileName = "test85.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at MainTest.main(test86.kt:10) test + +User code: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test86.MainTest", methodName = "main", fileName = "test86.kt", lineNumber = 10) + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test87.kt:10) test + +User code: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test87.MainTest", methodName = "main", fileName = "test87.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test88.kt:10) test + +User code: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test88.MainTest", methodName = "main", fileName = "test88.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}", throwable) at MainTest.main(test92.kt:10) test + +User code: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test92.MainTest", methodName = "main", fileName = "test92.kt", lineNumber = 10) + } + +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at MainTest.main(test93.kt:10) test + +User code: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test93.MainTest", methodName = "main", fileName = "test93.kt", lineNumber = 10) + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at MainTest.main(test94.kt:10) test + +User code: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test94.MainTest", methodName = "main", fileName = "test94.kt", lineNumber = 10) + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test95.kt:10) test + +User code: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test95.MainTest", methodName = "main", fileName = "test95.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at MainTest.main(test96.kt:10) test + +User code: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test96.MainTest", methodName = "main", fileName = "test96.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test97.kt:10) test + +User code: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test97.MainTest", methodName = "main", fileName = "test97.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test98.kt:10) test + +User code: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test98.MainTest", methodName = "main", fileName = "test98.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test99.kt:10) test + +User code: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test99.MainTest", methodName = "main", fileName = "test99.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test100.kt:10) test + +User code: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test100.MainTest", methodName = "main", fileName = "test100.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test101.kt:10) test + +User code: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test101.MainTest", methodName = "main", fileName = "test101.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at MainTest.main(test102.kt:10) test + +User code: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test102.MainTest", methodName = "main", fileName = "test102.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test103.kt:10) test + +User code: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test103.MainTest", methodName = "main", fileName = "test103.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test104.kt:10) test + +User code: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test104.MainTest", methodName = "main", fileName = "test104.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at MainTest.main(test105.kt:10) test + +User code: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test105.MainTest", methodName = "main", fileName = "test105.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at MainTest.main(test106.kt:10) test + +User code: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test106.MainTest", methodName = "main", fileName = "test106.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test107.kt:10) test + +User code: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test107.MainTest", methodName = "main", fileName = "test107.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at MainTest.main(test108.kt:10) test + +User code: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test108.MainTest", methodName = "main", fileName = "test108.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test112.kt:10) test + +User code: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test112.MainTest", methodName = "main", fileName = "test112.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test113.kt:10) test + +User code: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test113.MainTest", methodName = "main", fileName = "test113.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test114.kt:10) test + +User code: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test114.MainTest", methodName = "main", fileName = "test114.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test115.kt:10) test + +User code: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test115.MainTest", methodName = "main", fileName = "test115.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test116.kt:10) test + +User code: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test116.MainTest", methodName = "main", fileName = "test116.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test117.kt:10) test + +User code: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test117.MainTest", methodName = "main", fileName = "test117.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at MainTest.main(test118.kt:10) test + +User code: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test118.MainTest", methodName = "main", fileName = "test118.kt", lineNumber = 10) + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test119.kt:10) test + +User code: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test119.MainTest", methodName = "main", fileName = "test119.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test120.kt:10) test + +User code: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test120.MainTest", methodName = "main", fileName = "test120.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}") at MainTest.main(test124.kt:10) test + +User code: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") + } + +} +``` + +Transformed into: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test124.MainTest", methodName = "main", fileName = "test124.kt", lineNumber = 10) + } + +} +``` + +
+ +### debug() { "debug messageBuilder" } at MainTest.main(test125.kt:10) test + +User code: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test125.MainTest", methodName = "main", fileName = "test125.kt", lineNumber = 10) + } + +} +``` + +### debug() { "debug messageBuilder $i" } at MainTest.main(test126.kt:10) test + +User code: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test126.MainTest", methodName = "main", fileName = "test126.kt", lineNumber = 10) + } + +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at MainTest.main(test127.kt:10) test + +User code: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test127.MainTest", methodName = "main", fileName = "test127.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at MainTest.main(test128.kt:10) test + +User code: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test128.MainTest", methodName = "main", fileName = "test128.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at MainTest.main(test129.kt:10) test + +User code: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test129.MainTest", methodName = "main", fileName = "test129.kt", lineNumber = 10) + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test130.kt:10) test + +User code: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test130.MainTest", methodName = "main", fileName = "test130.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at MainTest.main(test131.kt:10) test + +User code: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test131.MainTest", methodName = "main", fileName = "test131.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test132.kt:10) test + +User code: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test132.MainTest", methodName = "main", fileName = "test132.kt", lineNumber = 10) + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test133.kt:10) test + +User code: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test133.MainTest", methodName = "main", fileName = "test133.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at MainTest.main(test134.kt:10) test + +User code: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test134.MainTest", methodName = "main", fileName = "test134.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test135.kt:10) test + +User code: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test135.MainTest", methodName = "main", fileName = "test135.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test136.kt:10) test + +User code: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test136.MainTest", methodName = "main", fileName = "test136.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at MainTest.main(test137.kt:10) test + +User code: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test137.MainTest", methodName = "main", fileName = "test137.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at MainTest.main(test138.kt:10) test + +User code: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test138.MainTest", methodName = "main", fileName = "test138.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test139.kt:10) test + +User code: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test139.MainTest", methodName = "main", fileName = "test139.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at MainTest.main(test140.kt:10) test + +User code: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test140.MainTest", methodName = "main", fileName = "test140.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at MainTest.main(test141.kt:10) test + +User code: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test141.MainTest", methodName = "main", fileName = "test141.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at MainTest.main(test142.kt:10) test + +User code: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test142.MainTest", methodName = "main", fileName = "test142.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test143.kt:10) test + +User code: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test143.MainTest", methodName = "main", fileName = "test143.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test144.kt:10) test + +User code: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test144.MainTest", methodName = "main", fileName = "test144.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test145.kt:10) test + +User code: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test145.MainTest", methodName = "main", fileName = "test145.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test146.kt:10) test + +User code: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test146.MainTest", methodName = "main", fileName = "test146.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test147.kt:10) test + +User code: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test147.MainTest", methodName = "main", fileName = "test147.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test148.kt:10) test + +User code: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test148.MainTest", methodName = "main", fileName = "test148.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test149.kt:10) test + +User code: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test149.MainTest", methodName = "main", fileName = "test149.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at MainTest.main(test150.kt:10) test + +User code: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test150.MainTest", methodName = "main", fileName = "test150.kt", lineNumber = 10) + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test151.kt:10) test + +User code: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test151.MainTest", methodName = "main", fileName = "test151.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test152.kt:10) test + +User code: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test152.MainTest", methodName = "main", fileName = "test152.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}", throwable) at MainTest.main(test156.kt:10) test + +User code: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test156.MainTest", methodName = "main", fileName = "test156.kt", lineNumber = 10) + } + +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at MainTest.main(test157.kt:10) test + +User code: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test157.MainTest", methodName = "main", fileName = "test157.kt", lineNumber = 10) + } + +} +``` + +### info(throwable) { "info messageBuilder $i" } at MainTest.main(test158.kt:10) test + +User code: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test158.MainTest", methodName = "main", fileName = "test158.kt", lineNumber = 10) + } + +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test159.kt:10) test + +User code: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test159.MainTest", methodName = "main", fileName = "test159.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at MainTest.main(test160.kt:10) test + +User code: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test160.MainTest", methodName = "main", fileName = "test160.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test161.kt:10) test + +User code: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test161.MainTest", methodName = "main", fileName = "test161.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test162.kt:10) test + +User code: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test162.MainTest", methodName = "main", fileName = "test162.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at MainTest.main(test163.kt:10) test + +User code: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test163.MainTest", methodName = "main", fileName = "test163.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test164.kt:10) test + +User code: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test164.MainTest", methodName = "main", fileName = "test164.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test165.kt:10) test + +User code: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test165.MainTest", methodName = "main", fileName = "test165.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at MainTest.main(test166.kt:10) test + +User code: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test166.MainTest", methodName = "main", fileName = "test166.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test167.kt:10) test + +User code: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test167.MainTest", methodName = "main", fileName = "test167.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test168.kt:10) test + +User code: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test168.MainTest", methodName = "main", fileName = "test168.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at MainTest.main(test169.kt:10) test + +User code: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test169.MainTest", methodName = "main", fileName = "test169.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at MainTest.main(test170.kt:10) test + +User code: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test170.MainTest", methodName = "main", fileName = "test170.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test171.kt:10) test + +User code: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test171.MainTest", methodName = "main", fileName = "test171.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at MainTest.main(test172.kt:10) test + +User code: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test172.MainTest", methodName = "main", fileName = "test172.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at MainTest.main(test176.kt:10) test + +User code: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test176.MainTest", methodName = "main", fileName = "test176.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test177.kt:10) test + +User code: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test177.MainTest", methodName = "main", fileName = "test177.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test178.kt:10) test + +User code: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test178.MainTest", methodName = "main", fileName = "test178.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at MainTest.main(test179.kt:10) test + +User code: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test179.MainTest", methodName = "main", fileName = "test179.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test180.kt:10) test + +User code: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test180.MainTest", methodName = "main", fileName = "test180.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test181.kt:10) test + +User code: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test181.MainTest", methodName = "main", fileName = "test181.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at MainTest.main(test182.kt:10) test + +User code: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test182.MainTest", methodName = "main", fileName = "test182.kt", lineNumber = 10) + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test183.kt:10) test + +User code: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test183.MainTest", methodName = "main", fileName = "test183.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test184.kt:10) test + +User code: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test184.MainTest", methodName = "main", fileName = "test184.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}") at MainTest.main(test188.kt:10) test + +User code: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") + } + +} +``` + +Transformed into: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test188.MainTest", methodName = "main", fileName = "test188.kt", lineNumber = 10) + } + +} +``` + +
+ +### info() { "info messageBuilder" } at MainTest.main(test189.kt:10) test + +User code: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test189.MainTest", methodName = "main", fileName = "test189.kt", lineNumber = 10) + } + +} +``` + +### info() { "info messageBuilder $i" } at MainTest.main(test190.kt:10) test + +User code: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test190.MainTest", methodName = "main", fileName = "test190.kt", lineNumber = 10) + } + +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at MainTest.main(test191.kt:10) test + +User code: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test191.MainTest", methodName = "main", fileName = "test191.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=null } at MainTest.main(test192.kt:10) test + +User code: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test192.MainTest", methodName = "main", fileName = "test192.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at MainTest.main(test193.kt:10) test + +User code: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test193.MainTest", methodName = "main", fileName = "test193.kt", lineNumber = 10) + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test194.kt:10) test + +User code: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test194.MainTest", methodName = "main", fileName = "test194.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at MainTest.main(test195.kt:10) test + +User code: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test195.MainTest", methodName = "main", fileName = "test195.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at MainTest.main(test196.kt:10) test + +User code: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test196.MainTest", methodName = "main", fileName = "test196.kt", lineNumber = 10) + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test197.kt:10) test + +User code: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test197.MainTest", methodName = "main", fileName = "test197.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at MainTest.main(test198.kt:10) test + +User code: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test198.MainTest", methodName = "main", fileName = "test198.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test199.kt:10) test + +User code: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test199.MainTest", methodName = "main", fileName = "test199.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test200.kt:10) test + +User code: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test200.MainTest", methodName = "main", fileName = "test200.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at MainTest.main(test201.kt:10) test + +User code: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test201.MainTest", methodName = "main", fileName = "test201.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at MainTest.main(test202.kt:10) test + +User code: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test202.MainTest", methodName = "main", fileName = "test202.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test203.kt:10) test + +User code: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test203.MainTest", methodName = "main", fileName = "test203.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at MainTest.main(test204.kt:10) test + +User code: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test204.MainTest", methodName = "main", fileName = "test204.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at MainTest.main(test205.kt:10) test + +User code: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test205.MainTest", methodName = "main", fileName = "test205.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at MainTest.main(test206.kt:10) test + +User code: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test206.MainTest", methodName = "main", fileName = "test206.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test207.kt:10) test + +User code: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test207.MainTest", methodName = "main", fileName = "test207.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test208.kt:10) test + +User code: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test208.MainTest", methodName = "main", fileName = "test208.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test209.kt:10) test + +User code: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test209.MainTest", methodName = "main", fileName = "test209.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test210.kt:10) test + +User code: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test210.MainTest", methodName = "main", fileName = "test210.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test211.kt:10) test + +User code: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test211.MainTest", methodName = "main", fileName = "test211.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test212.kt:10) test + +User code: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test212.MainTest", methodName = "main", fileName = "test212.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test213.kt:10) test + +User code: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test213.MainTest", methodName = "main", fileName = "test213.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at MainTest.main(test214.kt:10) test + +User code: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test214.MainTest", methodName = "main", fileName = "test214.kt", lineNumber = 10) + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test215.kt:10) test + +User code: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test215.MainTest", methodName = "main", fileName = "test215.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test216.kt:10) test + +User code: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test216.MainTest", methodName = "main", fileName = "test216.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}", throwable) at MainTest.main(test220.kt:10) test + +User code: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test220.MainTest", methodName = "main", fileName = "test220.kt", lineNumber = 10) + } + +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at MainTest.main(test221.kt:10) test + +User code: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test221.MainTest", methodName = "main", fileName = "test221.kt", lineNumber = 10) + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at MainTest.main(test222.kt:10) test + +User code: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test222.MainTest", methodName = "main", fileName = "test222.kt", lineNumber = 10) + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test223.kt:10) test + +User code: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test223.MainTest", methodName = "main", fileName = "test223.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at MainTest.main(test224.kt:10) test + +User code: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test224.MainTest", methodName = "main", fileName = "test224.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test225.kt:10) test + +User code: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test225.MainTest", methodName = "main", fileName = "test225.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test226.kt:10) test + +User code: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test226.MainTest", methodName = "main", fileName = "test226.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test227.kt:10) test + +User code: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test227.MainTest", methodName = "main", fileName = "test227.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test228.kt:10) test + +User code: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test228.MainTest", methodName = "main", fileName = "test228.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test229.kt:10) test + +User code: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test229.MainTest", methodName = "main", fileName = "test229.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at MainTest.main(test230.kt:10) test + +User code: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test230.MainTest", methodName = "main", fileName = "test230.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test231.kt:10) test + +User code: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test231.MainTest", methodName = "main", fileName = "test231.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test232.kt:10) test + +User code: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test232.MainTest", methodName = "main", fileName = "test232.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at MainTest.main(test233.kt:10) test + +User code: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test233.MainTest", methodName = "main", fileName = "test233.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at MainTest.main(test234.kt:10) test + +User code: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test234.MainTest", methodName = "main", fileName = "test234.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test235.kt:10) test + +User code: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test235.MainTest", methodName = "main", fileName = "test235.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at MainTest.main(test236.kt:10) test + +User code: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test236.MainTest", methodName = "main", fileName = "test236.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test240.kt:10) test + +User code: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test240.MainTest", methodName = "main", fileName = "test240.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test241.kt:10) test + +User code: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test241.MainTest", methodName = "main", fileName = "test241.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test242.kt:10) test + +User code: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test242.MainTest", methodName = "main", fileName = "test242.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test243.kt:10) test + +User code: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test243.MainTest", methodName = "main", fileName = "test243.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test244.kt:10) test + +User code: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test244.MainTest", methodName = "main", fileName = "test244.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test245.kt:10) test + +User code: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test245.MainTest", methodName = "main", fileName = "test245.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at MainTest.main(test246.kt:10) test + +User code: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test246.MainTest", methodName = "main", fileName = "test246.kt", lineNumber = 10) + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test247.kt:10) test + +User code: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test247.MainTest", methodName = "main", fileName = "test247.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test248.kt:10) test + +User code: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test248.MainTest", methodName = "main", fileName = "test248.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}") at MainTest.main(test252.kt:10) test + +User code: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") + } + +} +``` + +Transformed into: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test252.MainTest", methodName = "main", fileName = "test252.kt", lineNumber = 10) + } + +} +``` + +
+ +### warn() { "warn messageBuilder" } at MainTest.main(test253.kt:10) test + +User code: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test253.MainTest", methodName = "main", fileName = "test253.kt", lineNumber = 10) + } + +} +``` + +### warn() { "warn messageBuilder $i" } at MainTest.main(test254.kt:10) test + +User code: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test254.MainTest", methodName = "main", fileName = "test254.kt", lineNumber = 10) + } + +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at MainTest.main(test255.kt:10) test + +User code: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test255.MainTest", methodName = "main", fileName = "test255.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at MainTest.main(test256.kt:10) test + +User code: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test256.MainTest", methodName = "main", fileName = "test256.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at MainTest.main(test257.kt:10) test + +User code: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test257.MainTest", methodName = "main", fileName = "test257.kt", lineNumber = 10) + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test258.kt:10) test + +User code: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test258.MainTest", methodName = "main", fileName = "test258.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at MainTest.main(test259.kt:10) test + +User code: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test259.MainTest", methodName = "main", fileName = "test259.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test260.kt:10) test + +User code: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test260.MainTest", methodName = "main", fileName = "test260.kt", lineNumber = 10) + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test261.kt:10) test + +User code: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test261.MainTest", methodName = "main", fileName = "test261.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at MainTest.main(test262.kt:10) test + +User code: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test262.MainTest", methodName = "main", fileName = "test262.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test263.kt:10) test + +User code: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test263.MainTest", methodName = "main", fileName = "test263.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test264.kt:10) test + +User code: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test264.MainTest", methodName = "main", fileName = "test264.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at MainTest.main(test265.kt:10) test + +User code: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test265.MainTest", methodName = "main", fileName = "test265.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at MainTest.main(test266.kt:10) test + +User code: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test266.MainTest", methodName = "main", fileName = "test266.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test267.kt:10) test + +User code: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test267.MainTest", methodName = "main", fileName = "test267.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at MainTest.main(test268.kt:10) test + +User code: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test268.MainTest", methodName = "main", fileName = "test268.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at MainTest.main(test269.kt:10) test + +User code: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test269.MainTest", methodName = "main", fileName = "test269.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at MainTest.main(test270.kt:10) test + +User code: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test270.MainTest", methodName = "main", fileName = "test270.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test271.kt:10) test + +User code: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test271.MainTest", methodName = "main", fileName = "test271.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test272.kt:10) test + +User code: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test272.MainTest", methodName = "main", fileName = "test272.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test273.kt:10) test + +User code: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test273.MainTest", methodName = "main", fileName = "test273.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test274.kt:10) test + +User code: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test274.MainTest", methodName = "main", fileName = "test274.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test275.kt:10) test + +User code: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test275.MainTest", methodName = "main", fileName = "test275.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test276.kt:10) test + +User code: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test276.MainTest", methodName = "main", fileName = "test276.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test277.kt:10) test + +User code: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test277.MainTest", methodName = "main", fileName = "test277.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at MainTest.main(test278.kt:10) test + +User code: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test278.MainTest", methodName = "main", fileName = "test278.kt", lineNumber = 10) + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test279.kt:10) test + +User code: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test279.MainTest", methodName = "main", fileName = "test279.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test280.kt:10) test + +User code: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test280.MainTest", methodName = "main", fileName = "test280.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}", throwable) at MainTest.main(test284.kt:10) test + +User code: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test284.MainTest", methodName = "main", fileName = "test284.kt", lineNumber = 10) + } + +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at MainTest.main(test285.kt:10) test + +User code: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test285.MainTest", methodName = "main", fileName = "test285.kt", lineNumber = 10) + } + +} +``` + +### error(throwable) { "error messageBuilder $i" } at MainTest.main(test286.kt:10) test + +User code: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test286.MainTest", methodName = "main", fileName = "test286.kt", lineNumber = 10) + } + +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test287.kt:10) test + +User code: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test287.MainTest", methodName = "main", fileName = "test287.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=throwable } at MainTest.main(test288.kt:10) test + +User code: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test288.MainTest", methodName = "main", fileName = "test288.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test289.kt:10) test + +User code: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test289.MainTest", methodName = "main", fileName = "test289.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test290.kt:10) test + +User code: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test290.MainTest", methodName = "main", fileName = "test290.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at MainTest.main(test291.kt:10) test + +User code: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test291.MainTest", methodName = "main", fileName = "test291.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test292.kt:10) test + +User code: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test292.MainTest", methodName = "main", fileName = "test292.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test293.kt:10) test + +User code: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test293.MainTest", methodName = "main", fileName = "test293.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at MainTest.main(test294.kt:10) test + +User code: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test294.MainTest", methodName = "main", fileName = "test294.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test295.kt:10) test + +User code: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test295.MainTest", methodName = "main", fileName = "test295.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test296.kt:10) test + +User code: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test296.MainTest", methodName = "main", fileName = "test296.kt", lineNumber = 10) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at MainTest.main(test297.kt:10) test + +User code: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test297.MainTest", methodName = "main", fileName = "test297.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at MainTest.main(test298.kt:10) test + +User code: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test298.MainTest", methodName = "main", fileName = "test298.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test299.kt:10) test + +User code: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test299.MainTest", methodName = "main", fileName = "test299.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at MainTest.main(test300.kt:10) test + +User code: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test300.MainTest", methodName = "main", fileName = "test300.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at MainTest.main(test304.kt:10) test + +User code: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test304.MainTest", methodName = "main", fileName = "test304.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test305.kt:10) test + +User code: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test305.MainTest", methodName = "main", fileName = "test305.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test306.kt:10) test + +User code: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test306.MainTest", methodName = "main", fileName = "test306.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at MainTest.main(test307.kt:10) test + +User code: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test307.MainTest", methodName = "main", fileName = "test307.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test308.kt:10) test + +User code: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test308.MainTest", methodName = "main", fileName = "test308.kt", lineNumber = 10) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test309.kt:10) test + +User code: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test309.MainTest", methodName = "main", fileName = "test309.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at MainTest.main(test310.kt:10) test + +User code: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test310.MainTest", methodName = "main", fileName = "test310.kt", lineNumber = 10) + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test311.kt:10) test + +User code: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test311.MainTest", methodName = "main", fileName = "test311.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test312.kt:10) test + +User code: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test312.MainTest", methodName = "main", fileName = "test312.kt", lineNumber = 10) + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}") at MainTest.main(test316.kt:10) test + +User code: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") + } + +} +``` + +Transformed into: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test316.MainTest", methodName = "main", fileName = "test316.kt", lineNumber = 10) + } + +} +``` + +
+ +### error() { "error messageBuilder" } at MainTest.main(test317.kt:10) test + +User code: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test317.MainTest", methodName = "main", fileName = "test317.kt", lineNumber = 10) + } + +} +``` + +### error() { "error messageBuilder $i" } at MainTest.main(test318.kt:10) test + +User code: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test318.MainTest", methodName = "main", fileName = "test318.kt", lineNumber = 10) + } + +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at MainTest.main(test319.kt:10) test + +User code: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test319.MainTest", methodName = "main", fileName = "test319.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=null } at MainTest.main(test320.kt:10) test + +User code: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test320.MainTest", methodName = "main", fileName = "test320.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at MainTest.main(test321.kt:10) test + +User code: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test321.MainTest", methodName = "main", fileName = "test321.kt", lineNumber = 10) + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test322.kt:10) test + +User code: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test322.MainTest", methodName = "main", fileName = "test322.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at MainTest.main(test323.kt:10) test + +User code: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test323.MainTest", methodName = "main", fileName = "test323.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at MainTest.main(test324.kt:10) test + +User code: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test324.MainTest", methodName = "main", fileName = "test324.kt", lineNumber = 10) + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test325.kt:10) test + +User code: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test325.MainTest", methodName = "main", fileName = "test325.kt", lineNumber = 10) + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
+ +
with class=false + +
entry/exit API + +### entry(argument1, argument2) at Test326Kt.main(test326.kt:10) test + +User code: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) +} +``` + +Transformed into: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entryWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "entry(argument1, argument2)", className = "test326.Test326Kt", methodName = "main", fileName = "test326.kt", lineNumber = 10)) +} +``` + +### exit(resultValue) at Test327Kt.main(test327.kt:10) test + +User code: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) +} +``` + +Transformed into: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "exit(resultValue)", className = "test327.Test327Kt", methodName = "main", fileName = "test327.kt", lineNumber = 10)) +} +``` + +### exit() at Test328Kt.main(test328.kt:10) test + +User code: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() +} +``` + +Transformed into: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(className = "test328.Test328Kt", methodName = "main", fileName = "test328.kt", lineNumber = 10)) +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at Test329Kt.main(test329.kt:10) test + +User code: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) +} +``` + +Remains as-is: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) +} +``` + +### catching(throwable) at Test330Kt.main(test330.kt:10) test + +User code: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) +} +``` + +Remains as-is: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at Test331Kt.main(test331.kt:10) test + +User code: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test331.Test331Kt", methodName = "main", fileName = "test331.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test332Kt.main(test332.kt:10) test + +User code: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test332.Test332Kt", methodName = "main", fileName = "test332.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test333Kt.main(test333.kt:10) test + +User code: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test333.Test333Kt", methodName = "main", fileName = "test333.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at Test334Kt.main(test334.kt:10) test + +User code: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test334.Test334Kt", methodName = "main", fileName = "test334.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at Test335Kt.main(test335.kt:10) test + +User code: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test335.Test335Kt", methodName = "main", fileName = "test335.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at Test336Kt.main(test336.kt:10) test + +User code: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test336.Test336Kt", methodName = "main", fileName = "test336.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at Test337Kt.main(test337.kt:10) test + +User code: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test337.Test337Kt", methodName = "main", fileName = "test337.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at Test338Kt.main(test338.kt:10) test + +User code: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test338.Test338Kt", methodName = "main", fileName = "test338.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at Test339Kt.main(test339.kt:10) test + +User code: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test339.Test339Kt", methodName = "main", fileName = "test339.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at Test340Kt.main(test340.kt:10) test + +User code: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test340.Test340Kt", methodName = "main", fileName = "test340.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at Test341Kt.main(test341.kt:10) test + +User code: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test341.Test341Kt", methodName = "main", fileName = "test341.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at Test342Kt.main(test342.kt:10) test + +User code: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test342.Test342Kt", methodName = "main", fileName = "test342.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test343Kt.main(test343.kt:10) test + +User code: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test343.Test343Kt", methodName = "main", fileName = "test343.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at Test344Kt.main(test344.kt:10) test + +User code: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test344.Test344Kt", methodName = "main", fileName = "test344.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at Test345Kt.main(test345.kt:10) test + +User code: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test345.Test345Kt", methodName = "main", fileName = "test345.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test346Kt.main(test346.kt:10) test + +User code: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test346.Test346Kt", methodName = "main", fileName = "test346.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at Test347Kt.main(test347.kt:10) test + +User code: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test347.Test347Kt", methodName = "main", fileName = "test347.kt", lineNumber = 10) +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test348Kt.main(test348.kt:10) test + +User code: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test348.Test348Kt", methodName = "main", fileName = "test348.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test349Kt.main(test349.kt:10) test + +User code: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test349.Test349Kt", methodName = "main", fileName = "test349.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}", throwable) at Test353Kt.main(test353.kt:10) test + +User code: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test353.Test353Kt", methodName = "main", fileName = "test353.kt", lineNumber = 10) +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at Test354Kt.main(test354.kt:10) test + +User code: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test354.Test354Kt", methodName = "main", fileName = "test354.kt", lineNumber = 10) +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at Test355Kt.main(test355.kt:10) test + +User code: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test355.Test355Kt", methodName = "main", fileName = "test355.kt", lineNumber = 10) +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at Test356Kt.main(test356.kt:10) test + +User code: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test356.Test356Kt", methodName = "main", fileName = "test356.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at Test357Kt.main(test357.kt:10) test + +User code: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test357.Test357Kt", methodName = "main", fileName = "test357.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at Test358Kt.main(test358.kt:10) test + +User code: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test358.Test358Kt", methodName = "main", fileName = "test358.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test359Kt.main(test359.kt:10) test + +User code: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test359.Test359Kt", methodName = "main", fileName = "test359.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at Test360Kt.main(test360.kt:10) test + +User code: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test360.Test360Kt", methodName = "main", fileName = "test360.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at Test361Kt.main(test361.kt:10) test + +User code: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test361.Test361Kt", methodName = "main", fileName = "test361.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test362Kt.main(test362.kt:10) test + +User code: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test362.Test362Kt", methodName = "main", fileName = "test362.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at Test363Kt.main(test363.kt:10) test + +User code: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test363.Test363Kt", methodName = "main", fileName = "test363.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test364Kt.main(test364.kt:10) test + +User code: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test364.Test364Kt", methodName = "main", fileName = "test364.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test365Kt.main(test365.kt:10) test + +User code: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test365.Test365Kt", methodName = "main", fileName = "test365.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at Test366Kt.main(test366.kt:10) test + +User code: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test366.Test366Kt", methodName = "main", fileName = "test366.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at Test367Kt.main(test367.kt:10) test + +User code: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test367.Test367Kt", methodName = "main", fileName = "test367.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at Test368Kt.main(test368.kt:10) test + +User code: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test368.Test368Kt", methodName = "main", fileName = "test368.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at Test369Kt.main(test369.kt:10) test + +User code: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test369.Test369Kt", methodName = "main", fileName = "test369.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at Test373Kt.main(test373.kt:10) test + +User code: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test373.Test373Kt", methodName = "main", fileName = "test373.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at Test374Kt.main(test374.kt:10) test + +User code: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test374.Test374Kt", methodName = "main", fileName = "test374.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test375Kt.main(test375.kt:10) test + +User code: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test375.Test375Kt", methodName = "main", fileName = "test375.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at Test376Kt.main(test376.kt:10) test + +User code: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test376.Test376Kt", methodName = "main", fileName = "test376.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at Test377Kt.main(test377.kt:10) test + +User code: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test377.Test377Kt", methodName = "main", fileName = "test377.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test378Kt.main(test378.kt:10) test + +User code: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test378.Test378Kt", methodName = "main", fileName = "test378.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at Test379Kt.main(test379.kt:10) test + +User code: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) +} +``` + +Transformed into: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test379.Test379Kt", methodName = "main", fileName = "test379.kt", lineNumber = 10) +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test380Kt.main(test380.kt:10) test + +User code: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test380.Test380Kt", methodName = "main", fileName = "test380.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test381Kt.main(test381.kt:10) test + +User code: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"", className = "test381.Test381Kt", methodName = "main", fileName = "test381.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}") at Test385Kt.main(test385.kt:10) test + +User code: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") +} +``` + +Transformed into: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"", className = "test385.Test385Kt", methodName = "main", fileName = "test385.kt", lineNumber = 10) +} +``` + +
+ +### trace() { "trace messageBuilder" } at Test386Kt.main(test386.kt:10) test + +User code: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"", className = "test386.Test386Kt", methodName = "main", fileName = "test386.kt", lineNumber = 10) +} +``` + +### trace() { "trace messageBuilder $i" } at Test387Kt.main(test387.kt:10) test + +User code: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"", className = "test387.Test387Kt", methodName = "main", fileName = "test387.kt", lineNumber = 10) +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at Test388Kt.main(test388.kt:10) test + +User code: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"", className = "test388.Test388Kt", methodName = "main", fileName = "test388.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at Test389Kt.main(test389.kt:10) test + +User code: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test389.Test389Kt", methodName = "main", fileName = "test389.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at Test390Kt.main(test390.kt:10) test + +User code: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test390.Test390Kt", methodName = "main", fileName = "test390.kt", lineNumber = 10) +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at Test391Kt.main(test391.kt:10) test + +User code: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test391.Test391Kt", methodName = "main", fileName = "test391.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at Test392Kt.main(test392.kt:10) test + +User code: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"", className = "test392.Test392Kt", methodName = "main", fileName = "test392.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at Test393Kt.main(test393.kt:10) test + +User code: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"", className = "test393.Test393Kt", methodName = "main", fileName = "test393.kt", lineNumber = 10) +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test394Kt.main(test394.kt:10) test + +User code: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"", className = "test394.Test394Kt", methodName = "main", fileName = "test394.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at Test395Kt.main(test395.kt:10) test + +User code: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test395.Test395Kt", methodName = "main", fileName = "test395.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test396Kt.main(test396.kt:10) test + +User code: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test396.Test396Kt", methodName = "main", fileName = "test396.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test397Kt.main(test397.kt:10) test + +User code: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test397.Test397Kt", methodName = "main", fileName = "test397.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at Test398Kt.main(test398.kt:10) test + +User code: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test398.Test398Kt", methodName = "main", fileName = "test398.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at Test399Kt.main(test399.kt:10) test + +User code: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test399.Test399Kt", methodName = "main", fileName = "test399.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at Test400Kt.main(test400.kt:10) test + +User code: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test400.Test400Kt", methodName = "main", fileName = "test400.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at Test401Kt.main(test401.kt:10) test + +User code: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test401.Test401Kt", methodName = "main", fileName = "test401.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at Test402Kt.main(test402.kt:10) test + +User code: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test402.Test402Kt", methodName = "main", fileName = "test402.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at Test403Kt.main(test403.kt:10) test + +User code: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test403.Test403Kt", methodName = "main", fileName = "test403.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at Test404Kt.main(test404.kt:10) test + +User code: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test404.Test404Kt", methodName = "main", fileName = "test404.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at Test405Kt.main(test405.kt:10) test + +User code: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test405.Test405Kt", methodName = "main", fileName = "test405.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at Test406Kt.main(test406.kt:10) test + +User code: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test406.Test406Kt", methodName = "main", fileName = "test406.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test407Kt.main(test407.kt:10) test + +User code: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test407.Test407Kt", methodName = "main", fileName = "test407.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at Test408Kt.main(test408.kt:10) test + +User code: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test408.Test408Kt", methodName = "main", fileName = "test408.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at Test409Kt.main(test409.kt:10) test + +User code: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test409.Test409Kt", methodName = "main", fileName = "test409.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test410Kt.main(test410.kt:10) test + +User code: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test410.Test410Kt", methodName = "main", fileName = "test410.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at Test411Kt.main(test411.kt:10) test + +User code: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test411.Test411Kt", methodName = "main", fileName = "test411.kt", lineNumber = 10) +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test412Kt.main(test412.kt:10) test + +User code: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test412.Test412Kt", methodName = "main", fileName = "test412.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test413Kt.main(test413.kt:10) test + +User code: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test413.Test413Kt", methodName = "main", fileName = "test413.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}", throwable) at Test417Kt.main(test417.kt:10) test + +User code: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test417.Test417Kt", methodName = "main", fileName = "test417.kt", lineNumber = 10) +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at Test418Kt.main(test418.kt:10) test + +User code: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test418.Test418Kt", methodName = "main", fileName = "test418.kt", lineNumber = 10) +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at Test419Kt.main(test419.kt:10) test + +User code: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test419.Test419Kt", methodName = "main", fileName = "test419.kt", lineNumber = 10) +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at Test420Kt.main(test420.kt:10) test + +User code: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test420.Test420Kt", methodName = "main", fileName = "test420.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at Test421Kt.main(test421.kt:10) test + +User code: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test421.Test421Kt", methodName = "main", fileName = "test421.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at Test422Kt.main(test422.kt:10) test + +User code: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test422.Test422Kt", methodName = "main", fileName = "test422.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test423Kt.main(test423.kt:10) test + +User code: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test423.Test423Kt", methodName = "main", fileName = "test423.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at Test424Kt.main(test424.kt:10) test + +User code: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test424.Test424Kt", methodName = "main", fileName = "test424.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at Test425Kt.main(test425.kt:10) test + +User code: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test425.Test425Kt", methodName = "main", fileName = "test425.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test426Kt.main(test426.kt:10) test + +User code: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test426.Test426Kt", methodName = "main", fileName = "test426.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at Test427Kt.main(test427.kt:10) test + +User code: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test427.Test427Kt", methodName = "main", fileName = "test427.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test428Kt.main(test428.kt:10) test + +User code: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test428.Test428Kt", methodName = "main", fileName = "test428.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test429Kt.main(test429.kt:10) test + +User code: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test429.Test429Kt", methodName = "main", fileName = "test429.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at Test430Kt.main(test430.kt:10) test + +User code: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test430.Test430Kt", methodName = "main", fileName = "test430.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at Test431Kt.main(test431.kt:10) test + +User code: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test431.Test431Kt", methodName = "main", fileName = "test431.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at Test432Kt.main(test432.kt:10) test + +User code: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test432.Test432Kt", methodName = "main", fileName = "test432.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at Test433Kt.main(test433.kt:10) test + +User code: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test433.Test433Kt", methodName = "main", fileName = "test433.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at Test437Kt.main(test437.kt:10) test + +User code: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test437.Test437Kt", methodName = "main", fileName = "test437.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at Test438Kt.main(test438.kt:10) test + +User code: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test438.Test438Kt", methodName = "main", fileName = "test438.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test439Kt.main(test439.kt:10) test + +User code: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test439.Test439Kt", methodName = "main", fileName = "test439.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at Test440Kt.main(test440.kt:10) test + +User code: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test440.Test440Kt", methodName = "main", fileName = "test440.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at Test441Kt.main(test441.kt:10) test + +User code: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test441.Test441Kt", methodName = "main", fileName = "test441.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test442Kt.main(test442.kt:10) test + +User code: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test442.Test442Kt", methodName = "main", fileName = "test442.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at Test443Kt.main(test443.kt:10) test + +User code: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) +} +``` + +Transformed into: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test443.Test443Kt", methodName = "main", fileName = "test443.kt", lineNumber = 10) +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test444Kt.main(test444.kt:10) test + +User code: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test444.Test444Kt", methodName = "main", fileName = "test444.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test445Kt.main(test445.kt:10) test + +User code: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"", className = "test445.Test445Kt", methodName = "main", fileName = "test445.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}") at Test449Kt.main(test449.kt:10) test + +User code: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") +} +``` + +Transformed into: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"", className = "test449.Test449Kt", methodName = "main", fileName = "test449.kt", lineNumber = 10) +} +``` + +
+ +### debug() { "debug messageBuilder" } at Test450Kt.main(test450.kt:10) test + +User code: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"", className = "test450.Test450Kt", methodName = "main", fileName = "test450.kt", lineNumber = 10) +} +``` + +### debug() { "debug messageBuilder $i" } at Test451Kt.main(test451.kt:10) test + +User code: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"", className = "test451.Test451Kt", methodName = "main", fileName = "test451.kt", lineNumber = 10) +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at Test452Kt.main(test452.kt:10) test + +User code: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"", className = "test452.Test452Kt", methodName = "main", fileName = "test452.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at Test453Kt.main(test453.kt:10) test + +User code: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test453.Test453Kt", methodName = "main", fileName = "test453.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at Test454Kt.main(test454.kt:10) test + +User code: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test454.Test454Kt", methodName = "main", fileName = "test454.kt", lineNumber = 10) +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at Test455Kt.main(test455.kt:10) test + +User code: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test455.Test455Kt", methodName = "main", fileName = "test455.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at Test456Kt.main(test456.kt:10) test + +User code: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"", className = "test456.Test456Kt", methodName = "main", fileName = "test456.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at Test457Kt.main(test457.kt:10) test + +User code: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"", className = "test457.Test457Kt", methodName = "main", fileName = "test457.kt", lineNumber = 10) +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test458Kt.main(test458.kt:10) test + +User code: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"", className = "test458.Test458Kt", methodName = "main", fileName = "test458.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at Test459Kt.main(test459.kt:10) test + +User code: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test459.Test459Kt", methodName = "main", fileName = "test459.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test460Kt.main(test460.kt:10) test + +User code: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test460.Test460Kt", methodName = "main", fileName = "test460.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test461Kt.main(test461.kt:10) test + +User code: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test461.Test461Kt", methodName = "main", fileName = "test461.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at Test462Kt.main(test462.kt:10) test + +User code: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test462.Test462Kt", methodName = "main", fileName = "test462.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at Test463Kt.main(test463.kt:10) test + +User code: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test463.Test463Kt", methodName = "main", fileName = "test463.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at Test464Kt.main(test464.kt:10) test + +User code: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test464.Test464Kt", methodName = "main", fileName = "test464.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at Test465Kt.main(test465.kt:10) test + +User code: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test465.Test465Kt", methodName = "main", fileName = "test465.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at Test466Kt.main(test466.kt:10) test + +User code: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test466.Test466Kt", methodName = "main", fileName = "test466.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at Test467Kt.main(test467.kt:10) test + +User code: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test467.Test467Kt", methodName = "main", fileName = "test467.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at Test468Kt.main(test468.kt:10) test + +User code: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test468.Test468Kt", methodName = "main", fileName = "test468.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at Test469Kt.main(test469.kt:10) test + +User code: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test469.Test469Kt", methodName = "main", fileName = "test469.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at Test470Kt.main(test470.kt:10) test + +User code: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test470.Test470Kt", methodName = "main", fileName = "test470.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test471Kt.main(test471.kt:10) test + +User code: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test471.Test471Kt", methodName = "main", fileName = "test471.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at Test472Kt.main(test472.kt:10) test + +User code: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test472.Test472Kt", methodName = "main", fileName = "test472.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at Test473Kt.main(test473.kt:10) test + +User code: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test473.Test473Kt", methodName = "main", fileName = "test473.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test474Kt.main(test474.kt:10) test + +User code: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test474.Test474Kt", methodName = "main", fileName = "test474.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at Test475Kt.main(test475.kt:10) test + +User code: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test475.Test475Kt", methodName = "main", fileName = "test475.kt", lineNumber = 10) +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test476Kt.main(test476.kt:10) test + +User code: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test476.Test476Kt", methodName = "main", fileName = "test476.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test477Kt.main(test477.kt:10) test + +User code: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test477.Test477Kt", methodName = "main", fileName = "test477.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### info("info message {}", throwable) at Test481Kt.main(test481.kt:10) test + +User code: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test481.Test481Kt", methodName = "main", fileName = "test481.kt", lineNumber = 10) +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at Test482Kt.main(test482.kt:10) test + +User code: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test482.Test482Kt", methodName = "main", fileName = "test482.kt", lineNumber = 10) +} +``` + +### info(throwable) { "info messageBuilder $i" } at Test483Kt.main(test483.kt:10) test + +User code: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test483.Test483Kt", methodName = "main", fileName = "test483.kt", lineNumber = 10) +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at Test484Kt.main(test484.kt:10) test + +User code: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test484.Test484Kt", methodName = "main", fileName = "test484.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at Test485Kt.main(test485.kt:10) test + +User code: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test485.Test485Kt", methodName = "main", fileName = "test485.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at Test486Kt.main(test486.kt:10) test + +User code: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test486.Test486Kt", methodName = "main", fileName = "test486.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test487Kt.main(test487.kt:10) test + +User code: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test487.Test487Kt", methodName = "main", fileName = "test487.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at Test488Kt.main(test488.kt:10) test + +User code: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test488.Test488Kt", methodName = "main", fileName = "test488.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at Test489Kt.main(test489.kt:10) test + +User code: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test489.Test489Kt", methodName = "main", fileName = "test489.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test490Kt.main(test490.kt:10) test + +User code: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test490.Test490Kt", methodName = "main", fileName = "test490.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at Test491Kt.main(test491.kt:10) test + +User code: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test491.Test491Kt", methodName = "main", fileName = "test491.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test492Kt.main(test492.kt:10) test + +User code: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test492.Test492Kt", methodName = "main", fileName = "test492.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test493Kt.main(test493.kt:10) test + +User code: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test493.Test493Kt", methodName = "main", fileName = "test493.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at Test494Kt.main(test494.kt:10) test + +User code: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test494.Test494Kt", methodName = "main", fileName = "test494.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at Test495Kt.main(test495.kt:10) test + +User code: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test495.Test495Kt", methodName = "main", fileName = "test495.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at Test496Kt.main(test496.kt:10) test + +User code: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test496.Test496Kt", methodName = "main", fileName = "test496.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at Test497Kt.main(test497.kt:10) test + +User code: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test497.Test497Kt", methodName = "main", fileName = "test497.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at Test501Kt.main(test501.kt:10) test + +User code: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test501.Test501Kt", methodName = "main", fileName = "test501.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at Test502Kt.main(test502.kt:10) test + +User code: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test502.Test502Kt", methodName = "main", fileName = "test502.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test503Kt.main(test503.kt:10) test + +User code: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test503.Test503Kt", methodName = "main", fileName = "test503.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at Test504Kt.main(test504.kt:10) test + +User code: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test504.Test504Kt", methodName = "main", fileName = "test504.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at Test505Kt.main(test505.kt:10) test + +User code: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test505.Test505Kt", methodName = "main", fileName = "test505.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test506Kt.main(test506.kt:10) test + +User code: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test506.Test506Kt", methodName = "main", fileName = "test506.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at Test507Kt.main(test507.kt:10) test + +User code: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) +} +``` + +Transformed into: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test507.Test507Kt", methodName = "main", fileName = "test507.kt", lineNumber = 10) +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test508Kt.main(test508.kt:10) test + +User code: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test508.Test508Kt", methodName = "main", fileName = "test508.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test509Kt.main(test509.kt:10) test + +User code: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"", className = "test509.Test509Kt", methodName = "main", fileName = "test509.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### info("info message {}") at Test513Kt.main(test513.kt:10) test + +User code: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") +} +``` + +Transformed into: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"", className = "test513.Test513Kt", methodName = "main", fileName = "test513.kt", lineNumber = 10) +} +``` + +
+ +### info() { "info messageBuilder" } at Test514Kt.main(test514.kt:10) test + +User code: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"", className = "test514.Test514Kt", methodName = "main", fileName = "test514.kt", lineNumber = 10) +} +``` + +### info() { "info messageBuilder $i" } at Test515Kt.main(test515.kt:10) test + +User code: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"", className = "test515.Test515Kt", methodName = "main", fileName = "test515.kt", lineNumber = 10) +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at Test516Kt.main(test516.kt:10) test + +User code: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"", className = "test516.Test516Kt", methodName = "main", fileName = "test516.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=null } at Test517Kt.main(test517.kt:10) test + +User code: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test517.Test517Kt", methodName = "main", fileName = "test517.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at Test518Kt.main(test518.kt:10) test + +User code: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test518.Test518Kt", methodName = "main", fileName = "test518.kt", lineNumber = 10) +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at Test519Kt.main(test519.kt:10) test + +User code: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test519.Test519Kt", methodName = "main", fileName = "test519.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at Test520Kt.main(test520.kt:10) test + +User code: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"", className = "test520.Test520Kt", methodName = "main", fileName = "test520.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at Test521Kt.main(test521.kt:10) test + +User code: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"", className = "test521.Test521Kt", methodName = "main", fileName = "test521.kt", lineNumber = 10) +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at Test522Kt.main(test522.kt:10) test + +User code: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"", className = "test522.Test522Kt", methodName = "main", fileName = "test522.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at Test523Kt.main(test523.kt:10) test + +User code: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test523.Test523Kt", methodName = "main", fileName = "test523.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test524Kt.main(test524.kt:10) test + +User code: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test524.Test524Kt", methodName = "main", fileName = "test524.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test525Kt.main(test525.kt:10) test + +User code: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test525.Test525Kt", methodName = "main", fileName = "test525.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at Test526Kt.main(test526.kt:10) test + +User code: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test526.Test526Kt", methodName = "main", fileName = "test526.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at Test527Kt.main(test527.kt:10) test + +User code: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test527.Test527Kt", methodName = "main", fileName = "test527.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at Test528Kt.main(test528.kt:10) test + +User code: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test528.Test528Kt", methodName = "main", fileName = "test528.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at Test529Kt.main(test529.kt:10) test + +User code: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test529.Test529Kt", methodName = "main", fileName = "test529.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at Test530Kt.main(test530.kt:10) test + +User code: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test530.Test530Kt", methodName = "main", fileName = "test530.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at Test531Kt.main(test531.kt:10) test + +User code: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test531.Test531Kt", methodName = "main", fileName = "test531.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at Test532Kt.main(test532.kt:10) test + +User code: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test532.Test532Kt", methodName = "main", fileName = "test532.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at Test533Kt.main(test533.kt:10) test + +User code: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test533.Test533Kt", methodName = "main", fileName = "test533.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at Test534Kt.main(test534.kt:10) test + +User code: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test534.Test534Kt", methodName = "main", fileName = "test534.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test535Kt.main(test535.kt:10) test + +User code: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test535.Test535Kt", methodName = "main", fileName = "test535.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at Test536Kt.main(test536.kt:10) test + +User code: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test536.Test536Kt", methodName = "main", fileName = "test536.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at Test537Kt.main(test537.kt:10) test + +User code: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test537.Test537Kt", methodName = "main", fileName = "test537.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test538Kt.main(test538.kt:10) test + +User code: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test538.Test538Kt", methodName = "main", fileName = "test538.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at Test539Kt.main(test539.kt:10) test + +User code: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test539.Test539Kt", methodName = "main", fileName = "test539.kt", lineNumber = 10) +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test540Kt.main(test540.kt:10) test + +User code: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test540.Test540Kt", methodName = "main", fileName = "test540.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test541Kt.main(test541.kt:10) test + +User code: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test541.Test541Kt", methodName = "main", fileName = "test541.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}", throwable) at Test545Kt.main(test545.kt:10) test + +User code: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test545.Test545Kt", methodName = "main", fileName = "test545.kt", lineNumber = 10) +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at Test546Kt.main(test546.kt:10) test + +User code: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test546.Test546Kt", methodName = "main", fileName = "test546.kt", lineNumber = 10) +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at Test547Kt.main(test547.kt:10) test + +User code: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test547.Test547Kt", methodName = "main", fileName = "test547.kt", lineNumber = 10) +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at Test548Kt.main(test548.kt:10) test + +User code: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test548.Test548Kt", methodName = "main", fileName = "test548.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at Test549Kt.main(test549.kt:10) test + +User code: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test549.Test549Kt", methodName = "main", fileName = "test549.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at Test550Kt.main(test550.kt:10) test + +User code: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test550.Test550Kt", methodName = "main", fileName = "test550.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test551Kt.main(test551.kt:10) test + +User code: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test551.Test551Kt", methodName = "main", fileName = "test551.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at Test552Kt.main(test552.kt:10) test + +User code: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test552.Test552Kt", methodName = "main", fileName = "test552.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at Test553Kt.main(test553.kt:10) test + +User code: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test553.Test553Kt", methodName = "main", fileName = "test553.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test554Kt.main(test554.kt:10) test + +User code: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test554.Test554Kt", methodName = "main", fileName = "test554.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at Test555Kt.main(test555.kt:10) test + +User code: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test555.Test555Kt", methodName = "main", fileName = "test555.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test556Kt.main(test556.kt:10) test + +User code: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test556.Test556Kt", methodName = "main", fileName = "test556.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test557Kt.main(test557.kt:10) test + +User code: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test557.Test557Kt", methodName = "main", fileName = "test557.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at Test558Kt.main(test558.kt:10) test + +User code: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test558.Test558Kt", methodName = "main", fileName = "test558.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at Test559Kt.main(test559.kt:10) test + +User code: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test559.Test559Kt", methodName = "main", fileName = "test559.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at Test560Kt.main(test560.kt:10) test + +User code: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test560.Test560Kt", methodName = "main", fileName = "test560.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at Test561Kt.main(test561.kt:10) test + +User code: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test561.Test561Kt", methodName = "main", fileName = "test561.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at Test565Kt.main(test565.kt:10) test + +User code: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test565.Test565Kt", methodName = "main", fileName = "test565.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at Test566Kt.main(test566.kt:10) test + +User code: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test566.Test566Kt", methodName = "main", fileName = "test566.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test567Kt.main(test567.kt:10) test + +User code: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test567.Test567Kt", methodName = "main", fileName = "test567.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at Test568Kt.main(test568.kt:10) test + +User code: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test568.Test568Kt", methodName = "main", fileName = "test568.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at Test569Kt.main(test569.kt:10) test + +User code: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test569.Test569Kt", methodName = "main", fileName = "test569.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test570Kt.main(test570.kt:10) test + +User code: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test570.Test570Kt", methodName = "main", fileName = "test570.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at Test571Kt.main(test571.kt:10) test + +User code: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) +} +``` + +Transformed into: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test571.Test571Kt", methodName = "main", fileName = "test571.kt", lineNumber = 10) +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test572Kt.main(test572.kt:10) test + +User code: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test572.Test572Kt", methodName = "main", fileName = "test572.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test573Kt.main(test573.kt:10) test + +User code: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"", className = "test573.Test573Kt", methodName = "main", fileName = "test573.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}") at Test577Kt.main(test577.kt:10) test + +User code: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") +} +``` + +Transformed into: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"", className = "test577.Test577Kt", methodName = "main", fileName = "test577.kt", lineNumber = 10) +} +``` + +
+ +### warn() { "warn messageBuilder" } at Test578Kt.main(test578.kt:10) test + +User code: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"", className = "test578.Test578Kt", methodName = "main", fileName = "test578.kt", lineNumber = 10) +} +``` + +### warn() { "warn messageBuilder $i" } at Test579Kt.main(test579.kt:10) test + +User code: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"", className = "test579.Test579Kt", methodName = "main", fileName = "test579.kt", lineNumber = 10) +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at Test580Kt.main(test580.kt:10) test + +User code: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"", className = "test580.Test580Kt", methodName = "main", fileName = "test580.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at Test581Kt.main(test581.kt:10) test + +User code: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test581.Test581Kt", methodName = "main", fileName = "test581.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at Test582Kt.main(test582.kt:10) test + +User code: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test582.Test582Kt", methodName = "main", fileName = "test582.kt", lineNumber = 10) +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at Test583Kt.main(test583.kt:10) test + +User code: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test583.Test583Kt", methodName = "main", fileName = "test583.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at Test584Kt.main(test584.kt:10) test + +User code: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"", className = "test584.Test584Kt", methodName = "main", fileName = "test584.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at Test585Kt.main(test585.kt:10) test + +User code: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"", className = "test585.Test585Kt", methodName = "main", fileName = "test585.kt", lineNumber = 10) +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test586Kt.main(test586.kt:10) test + +User code: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"", className = "test586.Test586Kt", methodName = "main", fileName = "test586.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at Test587Kt.main(test587.kt:10) test + +User code: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test587.Test587Kt", methodName = "main", fileName = "test587.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test588Kt.main(test588.kt:10) test + +User code: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test588.Test588Kt", methodName = "main", fileName = "test588.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test589Kt.main(test589.kt:10) test + +User code: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test589.Test589Kt", methodName = "main", fileName = "test589.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at Test590Kt.main(test590.kt:10) test + +User code: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test590.Test590Kt", methodName = "main", fileName = "test590.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at Test591Kt.main(test591.kt:10) test + +User code: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test591.Test591Kt", methodName = "main", fileName = "test591.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at Test592Kt.main(test592.kt:10) test + +User code: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test592.Test592Kt", methodName = "main", fileName = "test592.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at Test593Kt.main(test593.kt:10) test + +User code: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test593.Test593Kt", methodName = "main", fileName = "test593.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at Test594Kt.main(test594.kt:10) test + +User code: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test594.Test594Kt", methodName = "main", fileName = "test594.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at Test595Kt.main(test595.kt:10) test + +User code: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test595.Test595Kt", methodName = "main", fileName = "test595.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at Test596Kt.main(test596.kt:10) test + +User code: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test596.Test596Kt", methodName = "main", fileName = "test596.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at Test597Kt.main(test597.kt:10) test + +User code: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test597.Test597Kt", methodName = "main", fileName = "test597.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at Test598Kt.main(test598.kt:10) test + +User code: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test598.Test598Kt", methodName = "main", fileName = "test598.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test599Kt.main(test599.kt:10) test + +User code: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test599.Test599Kt", methodName = "main", fileName = "test599.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at Test600Kt.main(test600.kt:10) test + +User code: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test600.Test600Kt", methodName = "main", fileName = "test600.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at Test601Kt.main(test601.kt:10) test + +User code: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test601.Test601Kt", methodName = "main", fileName = "test601.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test602Kt.main(test602.kt:10) test + +User code: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test602.Test602Kt", methodName = "main", fileName = "test602.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at Test603Kt.main(test603.kt:10) test + +User code: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test603.Test603Kt", methodName = "main", fileName = "test603.kt", lineNumber = 10) +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test604Kt.main(test604.kt:10) test + +User code: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test604.Test604Kt", methodName = "main", fileName = "test604.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test605Kt.main(test605.kt:10) test + +User code: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test605.Test605Kt", methodName = "main", fileName = "test605.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### error("error message {}", throwable) at Test609Kt.main(test609.kt:10) test + +User code: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test609.Test609Kt", methodName = "main", fileName = "test609.kt", lineNumber = 10) +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at Test610Kt.main(test610.kt:10) test + +User code: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test610.Test610Kt", methodName = "main", fileName = "test610.kt", lineNumber = 10) +} +``` + +### error(throwable) { "error messageBuilder $i" } at Test611Kt.main(test611.kt:10) test + +User code: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test611.Test611Kt", methodName = "main", fileName = "test611.kt", lineNumber = 10) +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at Test612Kt.main(test612.kt:10) test + +User code: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test612.Test612Kt", methodName = "main", fileName = "test612.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=throwable } at Test613Kt.main(test613.kt:10) test + +User code: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test613.Test613Kt", methodName = "main", fileName = "test613.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at Test614Kt.main(test614.kt:10) test + +User code: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test614.Test614Kt", methodName = "main", fileName = "test614.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test615Kt.main(test615.kt:10) test + +User code: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test615.Test615Kt", methodName = "main", fileName = "test615.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at Test616Kt.main(test616.kt:10) test + +User code: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test616.Test616Kt", methodName = "main", fileName = "test616.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at Test617Kt.main(test617.kt:10) test + +User code: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test617.Test617Kt", methodName = "main", fileName = "test617.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test618Kt.main(test618.kt:10) test + +User code: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test618.Test618Kt", methodName = "main", fileName = "test618.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at Test619Kt.main(test619.kt:10) test + +User code: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test619.Test619Kt", methodName = "main", fileName = "test619.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test620Kt.main(test620.kt:10) test + +User code: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test620.Test620Kt", methodName = "main", fileName = "test620.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test621Kt.main(test621.kt:10) test + +User code: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test621.Test621Kt", methodName = "main", fileName = "test621.kt", lineNumber = 10) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at Test622Kt.main(test622.kt:10) test + +User code: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test622.Test622Kt", methodName = "main", fileName = "test622.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at Test623Kt.main(test623.kt:10) test + +User code: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test623.Test623Kt", methodName = "main", fileName = "test623.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at Test624Kt.main(test624.kt:10) test + +User code: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test624.Test624Kt", methodName = "main", fileName = "test624.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at Test625Kt.main(test625.kt:10) test + +User code: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test625.Test625Kt", methodName = "main", fileName = "test625.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at Test629Kt.main(test629.kt:10) test + +User code: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test629.Test629Kt", methodName = "main", fileName = "test629.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at Test630Kt.main(test630.kt:10) test + +User code: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test630.Test630Kt", methodName = "main", fileName = "test630.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test631Kt.main(test631.kt:10) test + +User code: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test631.Test631Kt", methodName = "main", fileName = "test631.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at Test632Kt.main(test632.kt:10) test + +User code: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test632.Test632Kt", methodName = "main", fileName = "test632.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at Test633Kt.main(test633.kt:10) test + +User code: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test633.Test633Kt", methodName = "main", fileName = "test633.kt", lineNumber = 10) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test634Kt.main(test634.kt:10) test + +User code: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test634.Test634Kt", methodName = "main", fileName = "test634.kt", lineNumber = 10) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at Test635Kt.main(test635.kt:10) test + +User code: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) +} +``` + +Transformed into: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test635.Test635Kt", methodName = "main", fileName = "test635.kt", lineNumber = 10) +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test636Kt.main(test636.kt:10) test + +User code: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"", className = "test636.Test636Kt", methodName = "main", fileName = "test636.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test637Kt.main(test637.kt:10) test + +User code: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"", className = "test637.Test637Kt", methodName = "main", fileName = "test637.kt", lineNumber = 10) +} +fun ab() = 12 +``` + +
+ +### error("error message {}") at Test641Kt.main(test641.kt:10) test + +User code: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") +} +``` + +Transformed into: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"", className = "test641.Test641Kt", methodName = "main", fileName = "test641.kt", lineNumber = 10) +} +``` + +
+ +### error() { "error messageBuilder" } at Test642Kt.main(test642.kt:10) test + +User code: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"", className = "test642.Test642Kt", methodName = "main", fileName = "test642.kt", lineNumber = 10) +} +``` + +### error() { "error messageBuilder $i" } at Test643Kt.main(test643.kt:10) test + +User code: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"", className = "test643.Test643Kt", methodName = "main", fileName = "test643.kt", lineNumber = 10) +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at Test644Kt.main(test644.kt:10) test + +User code: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"", className = "test644.Test644Kt", methodName = "main", fileName = "test644.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=null } at Test645Kt.main(test645.kt:10) test + +User code: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test645.Test645Kt", methodName = "main", fileName = "test645.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at Test646Kt.main(test646.kt:10) test + +User code: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test646.Test646Kt", methodName = "main", fileName = "test646.kt", lineNumber = 10) +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at Test647Kt.main(test647.kt:10) test + +User code: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test647.Test647Kt", methodName = "main", fileName = "test647.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at Test648Kt.main(test648.kt:10) test + +User code: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"", className = "test648.Test648Kt", methodName = "main", fileName = "test648.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at Test649Kt.main(test649.kt:10) test + +User code: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"", className = "test649.Test649Kt", methodName = "main", fileName = "test649.kt", lineNumber = 10) +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at Test650Kt.main(test650.kt:10) test + +User code: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"", className = "test650.Test650Kt", methodName = "main", fileName = "test650.kt", lineNumber = 10) +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
+ +
featureFlag=DISABLE_COLLECTING_CALL_SITE_INFORMATION + +
with class=true + +
entry/exit API + +### entry(argument1, argument2) at MainTest.main(test1.kt:10) test + +User code: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) + } + +} +``` + +Transformed into: +```kotlin +package test1 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entryWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "entry(argument1, argument2)")) + } + +} +``` + +### exit(resultValue) at MainTest.main(test2.kt:10) test + +User code: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) + } + +} +``` + +Transformed into: +```kotlin +package test2 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "exit(resultValue)")) + } + +} +``` + +### exit() at MainTest.main(test3.kt:10) test + +User code: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() + } + +} +``` + +Remains as-is: +```kotlin +package test3 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() + } + +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at MainTest.main(test4.kt:10) test + +User code: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) + } + +} +``` + +Transformed into: +```kotlin +package test4 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "throwing(throwable)"), throwable) + } + +} +``` + +### catching(throwable) at MainTest.main(test5.kt:10) test + +User code: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) + } + +} +``` + +Transformed into: +```kotlin +package test5 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catchingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "catching(throwable)"), throwable) + } + +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at MainTest.main(test6.kt:10) test + +User code: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test6 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test7.kt:10) test + +User code: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test7 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test8.kt:10) test + +User code: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test8 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at MainTest.main(test9.kt:10) test + +User code: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test9 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at MainTest.main(test10.kt:10) test + +User code: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test10 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test11.kt:10) test + +User code: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test11 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at MainTest.main(test12.kt:10) test + +User code: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test12 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at MainTest.main(test13.kt:10) test + +User code: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test13 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at MainTest.main(test14.kt:10) test + +User code: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test14 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test15.kt:10) test + +User code: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test15 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test16.kt:10) test + +User code: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test16 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test17.kt:10) test + +User code: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test17 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test18.kt:10) test + +User code: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test18 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test19.kt:10) test + +User code: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test19 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test20.kt:10) test + +User code: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test20 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test21.kt:10) test + +User code: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test21 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at MainTest.main(test22.kt:10) test + +User code: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test22 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test23.kt:10) test + +User code: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test23 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test24.kt:10) test + +User code: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test24 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}", throwable) at MainTest.main(test28.kt:10) test + +User code: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test28 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") + } + +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at MainTest.main(test29.kt:10) test + +User code: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test29 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"") + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at MainTest.main(test30.kt:10) test + +User code: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test30 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"") + } + +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test31.kt:10) test + +User code: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test31 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at MainTest.main(test32.kt:10) test + +User code: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test32 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test33.kt:10) test + +User code: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test33 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test34.kt:10) test + +User code: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test34 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at MainTest.main(test35.kt:10) test + +User code: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test35 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at MainTest.main(test36.kt:10) test + +User code: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test36 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test37.kt:10) test + +User code: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test37 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at MainTest.main(test38.kt:10) test + +User code: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test38 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test39.kt:10) test + +User code: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test39 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test40.kt:10) test + +User code: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test40 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at MainTest.main(test41.kt:10) test + +User code: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test41 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at MainTest.main(test42.kt:10) test + +User code: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test42 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at MainTest.main(test43.kt:10) test + +User code: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test43 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at MainTest.main(test44.kt:10) test + +User code: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test44 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test48.kt:10) test + +User code: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test48 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test49.kt:10) test + +User code: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test49 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test50.kt:10) test + +User code: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test50 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at MainTest.main(test51.kt:10) test + +User code: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test51 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test52.kt:10) test + +User code: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test52 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test53.kt:10) test + +User code: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test53 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at MainTest.main(test54.kt:10) test + +User code: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test54 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") + } + +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test55.kt:10) test + +User code: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test55 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test56.kt:10) test + +User code: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test56 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +``` + +
+ +### trace("trace message {}") at MainTest.main(test60.kt:10) test + +User code: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") + } + +} +``` + +Transformed into: +```kotlin +package test60 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") + } + +} +``` + +
+ +### trace() { "trace messageBuilder" } at MainTest.main(test61.kt:10) test + +User code: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test61 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"") + } + +} +``` + +### trace() { "trace messageBuilder $i" } at MainTest.main(test62.kt:10) test + +User code: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test62 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"") + } + +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at MainTest.main(test63.kt:10) test + +User code: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test63 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at MainTest.main(test64.kt:10) test + +User code: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test64 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") + } + +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at MainTest.main(test65.kt:10) test + +User code: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test65 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") + } + +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test66.kt:10) test + +User code: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test66 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at MainTest.main(test67.kt:10) test + +User code: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test67 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at MainTest.main(test68.kt:10) test + +User code: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test68 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") + } + +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test69.kt:10) test + +User code: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test69 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at MainTest.main(test70.kt:10) test + +User code: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test70 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test71.kt:10) test + +User code: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test71 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test72.kt:10) test + +User code: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test72 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at MainTest.main(test73.kt:10) test + +User code: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test73 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at MainTest.main(test74.kt:10) test + +User code: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test74 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test75.kt:10) test + +User code: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test75 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at MainTest.main(test76.kt:10) test + +User code: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test76 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at MainTest.main(test77.kt:10) test + +User code: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test77 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at MainTest.main(test78.kt:10) test + +User code: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test78 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test79.kt:10) test + +User code: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test79 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test80.kt:10) test + +User code: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test80 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test81.kt:10) test + +User code: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test81 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test82.kt:10) test + +User code: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test82 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test83.kt:10) test + +User code: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test83 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test84.kt:10) test + +User code: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test84 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test85.kt:10) test + +User code: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test85 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at MainTest.main(test86.kt:10) test + +User code: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test86 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test87.kt:10) test + +User code: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test87 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test88.kt:10) test + +User code: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test88 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}", throwable) at MainTest.main(test92.kt:10) test + +User code: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test92 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") + } + +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at MainTest.main(test93.kt:10) test + +User code: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test93 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"") + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at MainTest.main(test94.kt:10) test + +User code: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test94 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"") + } + +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test95.kt:10) test + +User code: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test95 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at MainTest.main(test96.kt:10) test + +User code: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test96 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test97.kt:10) test + +User code: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test97 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test98.kt:10) test + +User code: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test98 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at MainTest.main(test99.kt:10) test + +User code: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test99 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at MainTest.main(test100.kt:10) test + +User code: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test100 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test101.kt:10) test + +User code: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test101 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at MainTest.main(test102.kt:10) test + +User code: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test102 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test103.kt:10) test + +User code: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test103 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test104.kt:10) test + +User code: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test104 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at MainTest.main(test105.kt:10) test + +User code: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test105 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at MainTest.main(test106.kt:10) test + +User code: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test106 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at MainTest.main(test107.kt:10) test + +User code: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test107 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at MainTest.main(test108.kt:10) test + +User code: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test108 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test112.kt:10) test + +User code: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test112 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test113.kt:10) test + +User code: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test113 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test114.kt:10) test + +User code: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test114 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at MainTest.main(test115.kt:10) test + +User code: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test115 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test116.kt:10) test + +User code: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test116 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test117.kt:10) test + +User code: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test117 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at MainTest.main(test118.kt:10) test + +User code: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test118 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") + } + +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test119.kt:10) test + +User code: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test119 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test120.kt:10) test + +User code: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test120 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +``` + +
+ +### debug("debug message {}") at MainTest.main(test124.kt:10) test + +User code: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") + } + +} +``` + +Transformed into: +```kotlin +package test124 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") + } + +} +``` + +
+ +### debug() { "debug messageBuilder" } at MainTest.main(test125.kt:10) test + +User code: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test125 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"") + } + +} +``` + +### debug() { "debug messageBuilder $i" } at MainTest.main(test126.kt:10) test + +User code: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test126 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"") + } + +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at MainTest.main(test127.kt:10) test + +User code: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test127 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at MainTest.main(test128.kt:10) test + +User code: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test128 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") + } + +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at MainTest.main(test129.kt:10) test + +User code: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test129 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") + } + +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test130.kt:10) test + +User code: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test130 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at MainTest.main(test131.kt:10) test + +User code: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test131 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at MainTest.main(test132.kt:10) test + +User code: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test132 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") + } + +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test133.kt:10) test + +User code: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test133 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at MainTest.main(test134.kt:10) test + +User code: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test134 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test135.kt:10) test + +User code: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test135 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test136.kt:10) test + +User code: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test136 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at MainTest.main(test137.kt:10) test + +User code: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test137 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at MainTest.main(test138.kt:10) test + +User code: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test138 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test139.kt:10) test + +User code: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test139 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at MainTest.main(test140.kt:10) test + +User code: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test140 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at MainTest.main(test141.kt:10) test + +User code: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test141 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at MainTest.main(test142.kt:10) test + +User code: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test142 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test143.kt:10) test + +User code: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test143 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test144.kt:10) test + +User code: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test144 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test145.kt:10) test + +User code: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test145 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test146.kt:10) test + +User code: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test146 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at MainTest.main(test147.kt:10) test + +User code: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test147 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test148.kt:10) test + +User code: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test148 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test149.kt:10) test + +User code: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test149 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at MainTest.main(test150.kt:10) test + +User code: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test150 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test151.kt:10) test + +User code: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test151 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test152.kt:10) test + +User code: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test152 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}", throwable) at MainTest.main(test156.kt:10) test + +User code: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test156 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") + } + +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at MainTest.main(test157.kt:10) test + +User code: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test157 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"") + } + +} +``` + +### info(throwable) { "info messageBuilder $i" } at MainTest.main(test158.kt:10) test + +User code: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test158 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"") + } + +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at MainTest.main(test159.kt:10) test + +User code: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test159 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at MainTest.main(test160.kt:10) test + +User code: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test160 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test161.kt:10) test + +User code: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test161 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test162.kt:10) test + +User code: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test162 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at MainTest.main(test163.kt:10) test + +User code: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test163 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at MainTest.main(test164.kt:10) test + +User code: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test164 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test165.kt:10) test + +User code: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test165 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at MainTest.main(test166.kt:10) test + +User code: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test166 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test167.kt:10) test + +User code: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test167 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test168.kt:10) test + +User code: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test168 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at MainTest.main(test169.kt:10) test + +User code: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test169 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at MainTest.main(test170.kt:10) test + +User code: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test170 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at MainTest.main(test171.kt:10) test + +User code: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test171 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at MainTest.main(test172.kt:10) test + +User code: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test172 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at MainTest.main(test176.kt:10) test + +User code: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test176 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test177.kt:10) test + +User code: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test177 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test178.kt:10) test + +User code: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test178 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at MainTest.main(test179.kt:10) test + +User code: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test179 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at MainTest.main(test180.kt:10) test + +User code: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test180 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test181.kt:10) test + +User code: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test181 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at MainTest.main(test182.kt:10) test + +User code: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test182 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") + } + +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test183.kt:10) test + +User code: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test183 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test184.kt:10) test + +User code: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test184 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +``` + +
+ +### info("info message {}") at MainTest.main(test188.kt:10) test + +User code: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") + } + +} +``` + +Transformed into: +```kotlin +package test188 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") + } + +} +``` + +
+ +### info() { "info messageBuilder" } at MainTest.main(test189.kt:10) test + +User code: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test189 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"") + } + +} +``` + +### info() { "info messageBuilder $i" } at MainTest.main(test190.kt:10) test + +User code: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test190 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"") + } + +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at MainTest.main(test191.kt:10) test + +User code: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test191 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### atInfo() { message="info eventBuilder"; cause=null } at MainTest.main(test192.kt:10) test + +User code: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test192 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") + } + +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at MainTest.main(test193.kt:10) test + +User code: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test193 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") + } + +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test194.kt:10) test + +User code: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test194 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at MainTest.main(test195.kt:10) test + +User code: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test195 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at MainTest.main(test196.kt:10) test + +User code: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test196 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") + } + +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test197.kt:10) test + +User code: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test197 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at MainTest.main(test198.kt:10) test + +User code: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test198 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test199.kt:10) test + +User code: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test199 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test200.kt:10) test + +User code: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test200 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at MainTest.main(test201.kt:10) test + +User code: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test201 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at MainTest.main(test202.kt:10) test + +User code: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test202 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test203.kt:10) test + +User code: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test203 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at MainTest.main(test204.kt:10) test + +User code: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test204 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at MainTest.main(test205.kt:10) test + +User code: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test205 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at MainTest.main(test206.kt:10) test + +User code: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test206 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test207.kt:10) test + +User code: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test207 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test208.kt:10) test + +User code: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test208 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test209.kt:10) test + +User code: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test209 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test210.kt:10) test + +User code: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test210 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test211.kt:10) test + +User code: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test211 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test212.kt:10) test + +User code: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test212 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test213.kt:10) test + +User code: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test213 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at MainTest.main(test214.kt:10) test + +User code: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test214 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test215.kt:10) test + +User code: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test215 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test216.kt:10) test + +User code: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test216 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}", throwable) at MainTest.main(test220.kt:10) test + +User code: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test220 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") + } + +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at MainTest.main(test221.kt:10) test + +User code: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test221 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"") + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at MainTest.main(test222.kt:10) test + +User code: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test222 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"") + } + +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test223.kt:10) test + +User code: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test223 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at MainTest.main(test224.kt:10) test + +User code: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test224 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test225.kt:10) test + +User code: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test225 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test226.kt:10) test + +User code: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test226 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at MainTest.main(test227.kt:10) test + +User code: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test227 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at MainTest.main(test228.kt:10) test + +User code: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test228 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test229.kt:10) test + +User code: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test229 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at MainTest.main(test230.kt:10) test + +User code: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test230 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test231.kt:10) test + +User code: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test231 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test232.kt:10) test + +User code: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test232 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at MainTest.main(test233.kt:10) test + +User code: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test233 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at MainTest.main(test234.kt:10) test + +User code: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test234 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at MainTest.main(test235.kt:10) test + +User code: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test235 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at MainTest.main(test236.kt:10) test + +User code: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test236 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test240.kt:10) test + +User code: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test240 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test241.kt:10) test + +User code: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test241 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test242.kt:10) test + +User code: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test242 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at MainTest.main(test243.kt:10) test + +User code: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test243 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test244.kt:10) test + +User code: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test244 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test245.kt:10) test + +User code: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test245 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at MainTest.main(test246.kt:10) test + +User code: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test246 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") + } + +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test247.kt:10) test + +User code: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test247 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test248.kt:10) test + +User code: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test248 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +``` + +
+ +### warn("warn message {}") at MainTest.main(test252.kt:10) test + +User code: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") + } + +} +``` + +Transformed into: +```kotlin +package test252 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") + } + +} +``` + +
+ +### warn() { "warn messageBuilder" } at MainTest.main(test253.kt:10) test + +User code: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test253 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"") + } + +} +``` + +### warn() { "warn messageBuilder $i" } at MainTest.main(test254.kt:10) test + +User code: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test254 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"") + } + +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at MainTest.main(test255.kt:10) test + +User code: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test255 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at MainTest.main(test256.kt:10) test + +User code: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test256 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") + } + +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at MainTest.main(test257.kt:10) test + +User code: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test257 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") + } + +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test258.kt:10) test + +User code: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test258 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at MainTest.main(test259.kt:10) test + +User code: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test259 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at MainTest.main(test260.kt:10) test + +User code: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test260 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") + } + +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test261.kt:10) test + +User code: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test261 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at MainTest.main(test262.kt:10) test + +User code: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test262 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test263.kt:10) test + +User code: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test263 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test264.kt:10) test + +User code: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test264 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at MainTest.main(test265.kt:10) test + +User code: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test265 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at MainTest.main(test266.kt:10) test + +User code: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test266 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test267.kt:10) test + +User code: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test267 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at MainTest.main(test268.kt:10) test + +User code: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test268 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at MainTest.main(test269.kt:10) test + +User code: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test269 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at MainTest.main(test270.kt:10) test + +User code: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test270 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test271.kt:10) test + +User code: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test271 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test272.kt:10) test + +User code: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test272 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test273.kt:10) test + +User code: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test273 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test274.kt:10) test + +User code: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test274 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at MainTest.main(test275.kt:10) test + +User code: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test275 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test276.kt:10) test + +User code: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test276 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test277.kt:10) test + +User code: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test277 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at MainTest.main(test278.kt:10) test + +User code: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) + } + +} +``` + +Transformed into: +```kotlin +package test278 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at MainTest.main(test279.kt:10) test + +User code: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test279 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at MainTest.main(test280.kt:10) test + +User code: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test280 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}", throwable) at MainTest.main(test284.kt:10) test + +User code: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) + } + +} +``` + +Transformed into: +```kotlin +package test284 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") + } + +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at MainTest.main(test285.kt:10) test + +User code: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test285 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"") + } + +} +``` + +### error(throwable) { "error messageBuilder $i" } at MainTest.main(test286.kt:10) test + +User code: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test286 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"") + } + +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at MainTest.main(test287.kt:10) test + +User code: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test287 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=throwable } at MainTest.main(test288.kt:10) test + +User code: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test288 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test289.kt:10) test + +User code: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test289 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test290.kt:10) test + +User code: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test290 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at MainTest.main(test291.kt:10) test + +User code: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test291 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at MainTest.main(test292.kt:10) test + +User code: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } + } + +} +``` + +Transformed into: +```kotlin +package test292 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at MainTest.main(test293.kt:10) test + +User code: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test293 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at MainTest.main(test294.kt:10) test + +User code: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test294 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test295.kt:10) test + +User code: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test295 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test296.kt:10) test + +User code: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test296 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at MainTest.main(test297.kt:10) test + +User code: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test297 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at MainTest.main(test298.kt:10) test + +User code: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test298 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at MainTest.main(test299.kt:10) test + +User code: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test299 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at MainTest.main(test300.kt:10) test + +User code: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test300 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at MainTest.main(test304.kt:10) test + +User code: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test304 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test305.kt:10) test + +User code: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test305 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test306.kt:10) test + +User code: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test306 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at MainTest.main(test307.kt:10) test + +User code: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test307 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at MainTest.main(test308.kt:10) test + +User code: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test308 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") + } + +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test309.kt:10) test + +User code: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test309 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at MainTest.main(test310.kt:10) test + +User code: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) + } + +} +``` + +Transformed into: +```kotlin +package test310 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") + } + +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at MainTest.main(test311.kt:10) test + +User code: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test311 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"") + } + fun helper() = "Hello!" +} +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at MainTest.main(test312.kt:10) test + +User code: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) + } + fun ab() = 12 +} +``` + +Transformed into: +```kotlin +package test312 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"") + } + fun ab() = 12 +} +``` + +
+ +### error("error message {}") at MainTest.main(test316.kt:10) test + +User code: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") + } + +} +``` + +Transformed into: +```kotlin +package test316 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") + } + +} +``` + +
+ +### error() { "error messageBuilder" } at MainTest.main(test317.kt:10) test + +User code: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } + } + +} +``` + +Transformed into: +```kotlin +package test317 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"") + } + +} +``` + +### error() { "error messageBuilder $i" } at MainTest.main(test318.kt:10) test + +User code: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } + } + +} +``` + +Transformed into: +```kotlin +package test318 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"") + } + +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at MainTest.main(test319.kt:10) test + +User code: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test319 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### atError() { message="error eventBuilder"; cause=null } at MainTest.main(test320.kt:10) test + +User code: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test320 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") + } + +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at MainTest.main(test321.kt:10) test + +User code: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test321 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") + } + +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test322.kt:10) test + +User code: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test322 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at MainTest.main(test323.kt:10) test + +User code: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test323 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at MainTest.main(test324.kt:10) test + +User code: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } + } + +} +``` + +Transformed into: +```kotlin +package test324 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") + } + +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at MainTest.main(test325.kt:10) test + +User code: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } + } + fun helper() = "Hello!" +} +``` + +Transformed into: +```kotlin +package test325 +import io.github.oshai.kotlinlogging.* + +public class MainTest { + fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") + } + fun helper() = "Hello!" +} +``` + +
+ +
+ +
+ +
+ +
with class=false + +
entry/exit API + +### entry(argument1, argument2) at Test326Kt.main(test326.kt:10) test + +User code: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entry(argument1, argument2) +} +``` + +Transformed into: +```kotlin +package test326 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val argument1 = 42; val argument2 = true + logger.entryWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "entry(argument1, argument2)")) +} +``` + +### exit(resultValue) at Test327Kt.main(test327.kt:10) test + +User code: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exit(resultValue) +} +``` + +Transformed into: +```kotlin +package test327 +import io.github.oshai.kotlinlogging.* + + +fun main(): Int { + val logger = KotlinLogging.logger {} + + + val resultValue = 42 + return logger.exitWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "exit(resultValue)")) +} +``` + +### exit() at Test328Kt.main(test328.kt:10) test + +User code: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() +} +``` + +Remains as-is: +```kotlin +package test328 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.exit() +} +``` + +
+ +
throwing/catching API + +### throwing(throwable) at Test329Kt.main(test329.kt:10) test + +User code: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwing(throwable) +} +``` + +Transformed into: +```kotlin +package test329 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + throw logger.throwingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "throwing(throwable)"), throwable) +} +``` + +### catching(throwable) at Test330Kt.main(test330.kt:10) test + +User code: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catching(throwable) +} +``` + +Transformed into: +```kotlin +package test330 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.catchingWithCompilerData(KLoggingEventBuilder.InternalCompilerData(messageTemplate = "catching(throwable)"), throwable) +} +``` + +
+ +
with log level=TRACE + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg, throwable) at Test331Kt.main(test331.kt:10) test + +User code: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test331 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test332Kt.main(test332.kt:10) test + +User code: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test332 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test333Kt.main(test333.kt:10) test + +User code: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test333 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker, throwable) { "trace messageBuilder" } at Test334Kt.main(test334.kt:10) test + +User code: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, throwable) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test334 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i" } at Test335Kt.main(test335.kt:10) test + +User code: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test335 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } at Test336Kt.main(test336.kt:10) test + +User code: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(marker, throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test336 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}", throwable) at Test337Kt.main(test337.kt:10) test + +User code: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(marker, "trace message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test337 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(throwable, marker) { "trace messageBuilder" } at Test338Kt.main(test338.kt:10) test + +User code: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.trace(throwable, marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test338 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i" } at Test339Kt.main(test339.kt:10) test + +User code: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test339 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } at Test340Kt.main(test340.kt:10) test + +User code: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable, marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test340 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder"; cause=throwable } at Test341Kt.main(test341.kt:10) test + +User code: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atTrace(marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test341 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } at Test342Kt.main(test342.kt:10) test + +User code: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test342 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test343Kt.main(test343.kt:10) test + +User code: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test343 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } at Test344Kt.main(test344.kt:10) test + +User code: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test344 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } at Test345Kt.main(test345.kt:10) test + +User code: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test345 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test346Kt.main(test346.kt:10) test + +User code: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test346 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg, throwable) at Test347Kt.main(test347.kt:10) test + +User code: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test347 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test348Kt.main(test348.kt:10) test + +User code: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test348 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test349Kt.main(test349.kt:10) test + +User code: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test349 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}", throwable) at Test353Kt.main(test353.kt:10) test + +User code: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace("trace message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test353 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") +} +``` + +
+ +### trace(throwable) { "trace messageBuilder" } at Test354Kt.main(test354.kt:10) test + +User code: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.trace(throwable) { "trace messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test354 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"") +} +``` + +### trace(throwable) { "trace messageBuilder $i" } at Test355Kt.main(test355.kt:10) test + +User code: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test355 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"") +} +``` + +### trace(throwable) { "trace messageBuilder $i ${helper()}" } at Test356Kt.main(test356.kt:10) test + +User code: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.trace(throwable) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test356 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=throwable } at Test357Kt.main(test357.kt:10) test + +User code: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atTrace() { message="trace eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test357 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=throwable } at Test358Kt.main(test358.kt:10) test + +User code: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test358 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test359Kt.main(test359.kt:10) test + +User code: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test359 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } at Test360Kt.main(test360.kt:10) test + +User code: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test360 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.TRACE) { message = "trace eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } at Test361Kt.main(test361.kt:10) test + +User code: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test361 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } at Test362Kt.main(test362.kt:10) test + +User code: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test362 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace(marker, "trace message {}", arg) at Test363Kt.main(test363.kt:10) test + +User code: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test363 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test364Kt.main(test364.kt:10) test + +User code: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.trace(marker, "trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test364 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.TRACE, marker) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test365Kt.main(test365.kt:10) test + +User code: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.trace(marker, "trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test365 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.TRACE, marker) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### trace(marker) { "trace messageBuilder" } at Test366Kt.main(test366.kt:10) test + +User code: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker) { "trace messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test366 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i" } at Test367Kt.main(test367.kt:10) test + +User code: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test367 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker) { "trace messageBuilder $i ${helper()}" } at Test368Kt.main(test368.kt:10) test + +User code: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.trace(marker) { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test368 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### trace(marker, "trace message {}") at Test369Kt.main(test369.kt:10) test + +User code: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.trace(marker, "trace message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test369 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atTrace(marker) { message="trace eventBuilder"; cause=null } at Test373Kt.main(test373.kt:10) test + +User code: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atTrace(marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test373 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i"; cause=null } at Test374Kt.main(test374.kt:10) test + +User code: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test374 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test375Kt.main(test375.kt:10) test + +User code: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atTrace(marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test375 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } at Test376Kt.main(test376.kt:10) test + +User code: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message="trace eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test376 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.TRACE, marker) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } at Test377Kt.main(test377.kt:10) test + +User code: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test377 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test378Kt.main(test378.kt:10) test + +User code: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test378 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.TRACE, marker) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### trace("trace message {}", arg) at Test379Kt.main(test379.kt:10) test + +User code: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {}", arg) +} +``` + +Transformed into: +```kotlin +package test379 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") +} +``` + +### trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test380Kt.main(test380.kt:10) test + +User code: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.trace("trace message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test380 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.TRACE) { message = "trace message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" +``` + +### trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test381Kt.main(test381.kt:10) test + +User code: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.trace("trace message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test381 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.TRACE) { message = "trace message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 +``` + +
+ +### trace("trace message {}") at Test385Kt.main(test385.kt:10) test + +User code: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace("trace message {}") +} +``` + +Transformed into: +```kotlin +package test385 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace message {}"") +} +``` + +
+ +### trace() { "trace messageBuilder" } at Test386Kt.main(test386.kt:10) test + +User code: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.trace() { "trace messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test386 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder"") +} +``` + +### trace() { "trace messageBuilder $i" } at Test387Kt.main(test387.kt:10) test + +User code: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test387 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i"") +} +``` + +### trace() { "trace messageBuilder $i ${helper()}" } at Test388Kt.main(test388.kt:10) test + +User code: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.trace() { "trace messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test388 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### atTrace() { message="trace eventBuilder"; cause=null } at Test389Kt.main(test389.kt:10) test + +User code: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atTrace() { message="trace eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test389 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") +} +``` + +### atTrace() { message="trace eventBuilder $i"; cause=null } at Test390Kt.main(test390.kt:10) test + +User code: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test390 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") +} +``` + +### atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } at Test391Kt.main(test391.kt:10) test + +User code: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atTrace() { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test391 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### at(Level.TRACE) { message="trace eventBuilder"; cause=null } at Test392Kt.main(test392.kt:10) test + +User code: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message="trace eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test392 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.TRACE) { message = "trace eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder"") +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } at Test393Kt.main(test393.kt:10) test + +User code: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test393 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i"") +} +``` + +### at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } at Test394Kt.main(test394.kt:10) test + +User code: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message="trace eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test394 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.TRACE) { message = "trace eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""trace eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=DEBUG + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg, throwable) at Test395Kt.main(test395.kt:10) test + +User code: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test395 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test396Kt.main(test396.kt:10) test + +User code: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test396 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test397Kt.main(test397.kt:10) test + +User code: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test397 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker, throwable) { "debug messageBuilder" } at Test398Kt.main(test398.kt:10) test + +User code: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, throwable) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test398 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i" } at Test399Kt.main(test399.kt:10) test + +User code: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test399 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } at Test400Kt.main(test400.kt:10) test + +User code: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(marker, throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test400 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}", throwable) at Test401Kt.main(test401.kt:10) test + +User code: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(marker, "debug message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test401 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(throwable, marker) { "debug messageBuilder" } at Test402Kt.main(test402.kt:10) test + +User code: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.debug(throwable, marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test402 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i" } at Test403Kt.main(test403.kt:10) test + +User code: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test403 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } at Test404Kt.main(test404.kt:10) test + +User code: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable, marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test404 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder"; cause=throwable } at Test405Kt.main(test405.kt:10) test + +User code: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atDebug(marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test405 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } at Test406Kt.main(test406.kt:10) test + +User code: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test406 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test407Kt.main(test407.kt:10) test + +User code: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test407 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } at Test408Kt.main(test408.kt:10) test + +User code: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test408 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } at Test409Kt.main(test409.kt:10) test + +User code: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test409 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test410Kt.main(test410.kt:10) test + +User code: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test410 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg, throwable) at Test411Kt.main(test411.kt:10) test + +User code: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test411 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test412Kt.main(test412.kt:10) test + +User code: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test412 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test413Kt.main(test413.kt:10) test + +User code: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test413 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}", throwable) at Test417Kt.main(test417.kt:10) test + +User code: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug("debug message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test417 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") +} +``` + +
+ +### debug(throwable) { "debug messageBuilder" } at Test418Kt.main(test418.kt:10) test + +User code: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.debug(throwable) { "debug messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test418 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"") +} +``` + +### debug(throwable) { "debug messageBuilder $i" } at Test419Kt.main(test419.kt:10) test + +User code: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test419 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"") +} +``` + +### debug(throwable) { "debug messageBuilder $i ${helper()}" } at Test420Kt.main(test420.kt:10) test + +User code: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.debug(throwable) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test420 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=throwable } at Test421Kt.main(test421.kt:10) test + +User code: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atDebug() { message="debug eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test421 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=throwable } at Test422Kt.main(test422.kt:10) test + +User code: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test422 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test423Kt.main(test423.kt:10) test + +User code: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test423 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } at Test424Kt.main(test424.kt:10) test + +User code: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test424 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } at Test425Kt.main(test425.kt:10) test + +User code: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test425 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } at Test426Kt.main(test426.kt:10) test + +User code: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test426 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug(marker, "debug message {}", arg) at Test427Kt.main(test427.kt:10) test + +User code: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test427 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test428Kt.main(test428.kt:10) test + +User code: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.debug(marker, "debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test428 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.DEBUG, marker) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test429Kt.main(test429.kt:10) test + +User code: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.debug(marker, "debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test429 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.DEBUG, marker) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### debug(marker) { "debug messageBuilder" } at Test430Kt.main(test430.kt:10) test + +User code: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker) { "debug messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test430 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i" } at Test431Kt.main(test431.kt:10) test + +User code: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test431 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker) { "debug messageBuilder $i ${helper()}" } at Test432Kt.main(test432.kt:10) test + +User code: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.debug(marker) { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test432 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### debug(marker, "debug message {}") at Test433Kt.main(test433.kt:10) test + +User code: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.debug(marker, "debug message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test433 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atDebug(marker) { message="debug eventBuilder"; cause=null } at Test437Kt.main(test437.kt:10) test + +User code: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atDebug(marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test437 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i"; cause=null } at Test438Kt.main(test438.kt:10) test + +User code: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test438 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test439Kt.main(test439.kt:10) test + +User code: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atDebug(marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test439 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } at Test440Kt.main(test440.kt:10) test + +User code: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message="debug eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test440 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } at Test441Kt.main(test441.kt:10) test + +User code: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test441 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test442Kt.main(test442.kt:10) test + +User code: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test442 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.DEBUG, marker) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### debug("debug message {}", arg) at Test443Kt.main(test443.kt:10) test + +User code: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {}", arg) +} +``` + +Transformed into: +```kotlin +package test443 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") +} +``` + +### debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test444Kt.main(test444.kt:10) test + +User code: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.debug("debug message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test444 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.DEBUG) { message = "debug message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" +``` + +### debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test445Kt.main(test445.kt:10) test + +User code: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.debug("debug message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test445 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.DEBUG) { message = "debug message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 +``` + +
+ +### debug("debug message {}") at Test449Kt.main(test449.kt:10) test + +User code: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug("debug message {}") +} +``` + +Transformed into: +```kotlin +package test449 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug message {}"") +} +``` + +
+ +### debug() { "debug messageBuilder" } at Test450Kt.main(test450.kt:10) test + +User code: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.debug() { "debug messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test450 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder"") +} +``` + +### debug() { "debug messageBuilder $i" } at Test451Kt.main(test451.kt:10) test + +User code: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test451 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i"") +} +``` + +### debug() { "debug messageBuilder $i ${helper()}" } at Test452Kt.main(test452.kt:10) test + +User code: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.debug() { "debug messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test452 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### atDebug() { message="debug eventBuilder"; cause=null } at Test453Kt.main(test453.kt:10) test + +User code: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atDebug() { message="debug eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test453 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") +} +``` + +### atDebug() { message="debug eventBuilder $i"; cause=null } at Test454Kt.main(test454.kt:10) test + +User code: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test454 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") +} +``` + +### atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } at Test455Kt.main(test455.kt:10) test + +User code: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atDebug() { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test455 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### at(Level.DEBUG) { message="debug eventBuilder"; cause=null } at Test456Kt.main(test456.kt:10) test + +User code: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message="debug eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test456 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.DEBUG) { message = "debug eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder"") +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } at Test457Kt.main(test457.kt:10) test + +User code: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test457 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i"") +} +``` + +### at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } at Test458Kt.main(test458.kt:10) test + +User code: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message="debug eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test458 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.DEBUG) { message = "debug eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""debug eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=INFO + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg, throwable) at Test459Kt.main(test459.kt:10) test + +User code: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test459 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test460Kt.main(test460.kt:10) test + +User code: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test460 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test461Kt.main(test461.kt:10) test + +User code: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test461 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker, throwable) { "info messageBuilder" } at Test462Kt.main(test462.kt:10) test + +User code: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, throwable) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test462 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i" } at Test463Kt.main(test463.kt:10) test + +User code: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test463 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, throwable) { "info messageBuilder $i ${helper()}" } at Test464Kt.main(test464.kt:10) test + +User code: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(marker, throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test464 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}", throwable) at Test465Kt.main(test465.kt:10) test + +User code: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(marker, "info message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test465 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(throwable, marker) { "info messageBuilder" } at Test466Kt.main(test466.kt:10) test + +User code: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.info(throwable, marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test466 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i" } at Test467Kt.main(test467.kt:10) test + +User code: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test467 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(throwable, marker) { "info messageBuilder $i ${helper()}" } at Test468Kt.main(test468.kt:10) test + +User code: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable, marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test468 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder"; cause=throwable } at Test469Kt.main(test469.kt:10) test + +User code: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atInfo(marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test469 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=throwable } at Test470Kt.main(test470.kt:10) test + +User code: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test470 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test471Kt.main(test471.kt:10) test + +User code: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test471 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } at Test472Kt.main(test472.kt:10) test + +User code: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test472 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } at Test473Kt.main(test473.kt:10) test + +User code: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test473 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test474Kt.main(test474.kt:10) test + +User code: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test474 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg, throwable) at Test475Kt.main(test475.kt:10) test + +User code: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test475 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test476Kt.main(test476.kt:10) test + +User code: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test476 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test477Kt.main(test477.kt:10) test + +User code: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test477 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 +``` + +
+ +### info("info message {}", throwable) at Test481Kt.main(test481.kt:10) test + +User code: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info("info message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test481 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") +} +``` + +
+ +### info(throwable) { "info messageBuilder" } at Test482Kt.main(test482.kt:10) test + +User code: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.info(throwable) { "info messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test482 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"") +} +``` + +### info(throwable) { "info messageBuilder $i" } at Test483Kt.main(test483.kt:10) test + +User code: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test483 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"") +} +``` + +### info(throwable) { "info messageBuilder $i ${helper()}" } at Test484Kt.main(test484.kt:10) test + +User code: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.info(throwable) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test484 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=throwable } at Test485Kt.main(test485.kt:10) test + +User code: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atInfo() { message="info eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test485 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=throwable } at Test486Kt.main(test486.kt:10) test + +User code: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test486 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test487Kt.main(test487.kt:10) test + +User code: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test487 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=throwable } at Test488Kt.main(test488.kt:10) test + +User code: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message="info eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test488 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.INFO) { message = "info eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } at Test489Kt.main(test489.kt:10) test + +User code: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test489 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } at Test490Kt.main(test490.kt:10) test + +User code: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test490 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info(marker, "info message {}", arg) at Test491Kt.main(test491.kt:10) test + +User code: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test491 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test492Kt.main(test492.kt:10) test + +User code: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.info(marker, "info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test492 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.INFO, marker) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test493Kt.main(test493.kt:10) test + +User code: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.info(marker, "info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test493 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.INFO, marker) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### info(marker) { "info messageBuilder" } at Test494Kt.main(test494.kt:10) test + +User code: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker) { "info messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test494 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i" } at Test495Kt.main(test495.kt:10) test + +User code: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test495 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker) { "info messageBuilder $i ${helper()}" } at Test496Kt.main(test496.kt:10) test + +User code: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.info(marker) { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test496 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### info(marker, "info message {}") at Test497Kt.main(test497.kt:10) test + +User code: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.info(marker, "info message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test497 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atInfo(marker) { message="info eventBuilder"; cause=null } at Test501Kt.main(test501.kt:10) test + +User code: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atInfo(marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test501 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i"; cause=null } at Test502Kt.main(test502.kt:10) test + +User code: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test502 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test503Kt.main(test503.kt:10) test + +User code: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atInfo(marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test503 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder"; cause=null } at Test504Kt.main(test504.kt:10) test + +User code: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message="info eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test504 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.INFO, marker) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } at Test505Kt.main(test505.kt:10) test + +User code: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test505 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } at Test506Kt.main(test506.kt:10) test + +User code: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test506 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.INFO, marker) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### info("info message {}", arg) at Test507Kt.main(test507.kt:10) test + +User code: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {}", arg) +} +``` + +Transformed into: +```kotlin +package test507 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") +} +``` + +### info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test508Kt.main(test508.kt:10) test + +User code: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.info("info message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test508 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.INFO) { message = "info message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" +``` + +### info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test509Kt.main(test509.kt:10) test + +User code: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.info("info message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test509 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.INFO) { message = "info message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 +``` + +
+ +### info("info message {}") at Test513Kt.main(test513.kt:10) test + +User code: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info("info message {}") +} +``` + +Transformed into: +```kotlin +package test513 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info message {}"") +} +``` + +
+ +### info() { "info messageBuilder" } at Test514Kt.main(test514.kt:10) test + +User code: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.info() { "info messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test514 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder"") +} +``` + +### info() { "info messageBuilder $i" } at Test515Kt.main(test515.kt:10) test + +User code: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test515 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i"") +} +``` + +### info() { "info messageBuilder $i ${helper()}" } at Test516Kt.main(test516.kt:10) test + +User code: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.info() { "info messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test516 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### atInfo() { message="info eventBuilder"; cause=null } at Test517Kt.main(test517.kt:10) test + +User code: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atInfo() { message="info eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test517 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") +} +``` + +### atInfo() { message="info eventBuilder $i"; cause=null } at Test518Kt.main(test518.kt:10) test + +User code: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test518 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") +} +``` + +### atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } at Test519Kt.main(test519.kt:10) test + +User code: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atInfo() { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test519 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### at(Level.INFO) { message="info eventBuilder"; cause=null } at Test520Kt.main(test520.kt:10) test + +User code: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message="info eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test520 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.INFO) { message = "info eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder"") +} +``` + +### at(Level.INFO) { message="info eventBuilder $i"; cause=null } at Test521Kt.main(test521.kt:10) test + +User code: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test521 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i"") +} +``` + +### at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } at Test522Kt.main(test522.kt:10) test + +User code: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message="info eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test522 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.INFO) { message = "info eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""info eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=WARN + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg, throwable) at Test523Kt.main(test523.kt:10) test + +User code: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test523 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test524Kt.main(test524.kt:10) test + +User code: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test524 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test525Kt.main(test525.kt:10) test + +User code: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test525 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker, throwable) { "warn messageBuilder" } at Test526Kt.main(test526.kt:10) test + +User code: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, throwable) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test526 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i" } at Test527Kt.main(test527.kt:10) test + +User code: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test527 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } at Test528Kt.main(test528.kt:10) test + +User code: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(marker, throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test528 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}", throwable) at Test529Kt.main(test529.kt:10) test + +User code: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(marker, "warn message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test529 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(throwable, marker) { "warn messageBuilder" } at Test530Kt.main(test530.kt:10) test + +User code: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.warn(throwable, marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test530 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i" } at Test531Kt.main(test531.kt:10) test + +User code: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test531 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } at Test532Kt.main(test532.kt:10) test + +User code: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable, marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test532 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder"; cause=throwable } at Test533Kt.main(test533.kt:10) test + +User code: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atWarn(marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test533 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } at Test534Kt.main(test534.kt:10) test + +User code: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test534 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test535Kt.main(test535.kt:10) test + +User code: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test535 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } at Test536Kt.main(test536.kt:10) test + +User code: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test536 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } at Test537Kt.main(test537.kt:10) test + +User code: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test537 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test538Kt.main(test538.kt:10) test + +User code: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test538 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg, throwable) at Test539Kt.main(test539.kt:10) test + +User code: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test539 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test540Kt.main(test540.kt:10) test + +User code: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test540 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test541Kt.main(test541.kt:10) test + +User code: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test541 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}", throwable) at Test545Kt.main(test545.kt:10) test + +User code: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn("warn message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test545 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") +} +``` + +
+ +### warn(throwable) { "warn messageBuilder" } at Test546Kt.main(test546.kt:10) test + +User code: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.warn(throwable) { "warn messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test546 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"") +} +``` + +### warn(throwable) { "warn messageBuilder $i" } at Test547Kt.main(test547.kt:10) test + +User code: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test547 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"") +} +``` + +### warn(throwable) { "warn messageBuilder $i ${helper()}" } at Test548Kt.main(test548.kt:10) test + +User code: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.warn(throwable) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test548 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=throwable } at Test549Kt.main(test549.kt:10) test + +User code: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atWarn() { message="warn eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test549 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=throwable } at Test550Kt.main(test550.kt:10) test + +User code: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test550 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test551Kt.main(test551.kt:10) test + +User code: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test551 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=throwable } at Test552Kt.main(test552.kt:10) test + +User code: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test552 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.WARN) { message = "warn eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } at Test553Kt.main(test553.kt:10) test + +User code: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test553 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } at Test554Kt.main(test554.kt:10) test + +User code: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test554 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn(marker, "warn message {}", arg) at Test555Kt.main(test555.kt:10) test + +User code: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test555 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test556Kt.main(test556.kt:10) test + +User code: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.warn(marker, "warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test556 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.WARN, marker) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test557Kt.main(test557.kt:10) test + +User code: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.warn(marker, "warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test557 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.WARN, marker) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### warn(marker) { "warn messageBuilder" } at Test558Kt.main(test558.kt:10) test + +User code: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker) { "warn messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test558 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i" } at Test559Kt.main(test559.kt:10) test + +User code: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test559 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker) { "warn messageBuilder $i ${helper()}" } at Test560Kt.main(test560.kt:10) test + +User code: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.warn(marker) { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test560 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### warn(marker, "warn message {}") at Test561Kt.main(test561.kt:10) test + +User code: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.warn(marker, "warn message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test561 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atWarn(marker) { message="warn eventBuilder"; cause=null } at Test565Kt.main(test565.kt:10) test + +User code: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atWarn(marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test565 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i"; cause=null } at Test566Kt.main(test566.kt:10) test + +User code: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test566 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test567Kt.main(test567.kt:10) test + +User code: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atWarn(marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test567 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } at Test568Kt.main(test568.kt:10) test + +User code: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message="warn eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test568 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.WARN, marker) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } at Test569Kt.main(test569.kt:10) test + +User code: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test569 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test570Kt.main(test570.kt:10) test + +User code: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test570 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.WARN, marker) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### warn("warn message {}", arg) at Test571Kt.main(test571.kt:10) test + +User code: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {}", arg) +} +``` + +Transformed into: +```kotlin +package test571 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") +} +``` + +### warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test572Kt.main(test572.kt:10) test + +User code: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.warn("warn message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test572 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.WARN) { message = "warn message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" +``` + +### warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test573Kt.main(test573.kt:10) test + +User code: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.warn("warn message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test573 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.WARN) { message = "warn message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 +``` + +
+ +### warn("warn message {}") at Test577Kt.main(test577.kt:10) test + +User code: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn("warn message {}") +} +``` + +Transformed into: +```kotlin +package test577 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn message {}"") +} +``` + +
+ +### warn() { "warn messageBuilder" } at Test578Kt.main(test578.kt:10) test + +User code: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.warn() { "warn messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test578 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder"") +} +``` + +### warn() { "warn messageBuilder $i" } at Test579Kt.main(test579.kt:10) test + +User code: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test579 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i"") +} +``` + +### warn() { "warn messageBuilder $i ${helper()}" } at Test580Kt.main(test580.kt:10) test + +User code: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.warn() { "warn messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test580 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### atWarn() { message="warn eventBuilder"; cause=null } at Test581Kt.main(test581.kt:10) test + +User code: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atWarn() { message="warn eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test581 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") +} +``` + +### atWarn() { message="warn eventBuilder $i"; cause=null } at Test582Kt.main(test582.kt:10) test + +User code: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test582 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") +} +``` + +### atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } at Test583Kt.main(test583.kt:10) test + +User code: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atWarn() { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test583 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### at(Level.WARN) { message="warn eventBuilder"; cause=null } at Test584Kt.main(test584.kt:10) test + +User code: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message="warn eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test584 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.WARN) { message = "warn eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder"") +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i"; cause=null } at Test585Kt.main(test585.kt:10) test + +User code: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test585 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i"") +} +``` + +### at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } at Test586Kt.main(test586.kt:10) test + +User code: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message="warn eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test586 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.WARN) { message = "warn eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""warn eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
with log level=ERROR + +
with throwable=true + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg, throwable) at Test587Kt.main(test587.kt:10) test + +User code: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {}", arg, throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test587 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test588Kt.main(test588.kt:10) test + +User code: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test588 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test589Kt.main(test589.kt:10) test + +User code: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test589 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker, throwable) { "error messageBuilder" } at Test590Kt.main(test590.kt:10) test + +User code: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, throwable) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test590 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i" } at Test591Kt.main(test591.kt:10) test + +User code: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test591 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, throwable) { "error messageBuilder $i ${helper()}" } at Test592Kt.main(test592.kt:10) test + +User code: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(marker, throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test592 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}", throwable) at Test593Kt.main(test593.kt:10) test + +User code: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(marker, "error message {}", throwable) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test593 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(throwable, marker) { "error messageBuilder" } at Test594Kt.main(test594.kt:10) test + +User code: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.error(throwable, marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test594 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i" } at Test595Kt.main(test595.kt:10) test + +User code: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test595 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(throwable, marker) { "error messageBuilder $i ${helper()}" } at Test596Kt.main(test596.kt:10) test + +User code: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable, marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test596 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder"; cause=throwable } at Test597Kt.main(test597.kt:10) test + +User code: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.atError(marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test597 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=throwable } at Test598Kt.main(test598.kt:10) test + +User code: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test598 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test599Kt.main(test599.kt:10) test + +User code: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test599 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } at Test600Kt.main(test600.kt:10) test + +User code: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test600 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } at Test601Kt.main(test601.kt:10) test + +User code: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=throwable } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test601 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test602Kt.main(test602.kt:10) test + +User code: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test602 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg, throwable) at Test603Kt.main(test603.kt:10) test + +User code: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {}", arg, throwable) +} +``` + +Transformed into: +```kotlin +package test603 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) at Test604Kt.main(test604.kt:10) test + +User code: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper(), throwable) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test604 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!java.lang.Exception: expected! abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) at Test605Kt.main(test605.kt:10) test + +User code: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab(), throwable) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test605 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 +``` + +
+ +### error("error message {}", throwable) at Test609Kt.main(test609.kt:10) test + +User code: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error("error message {}", throwable) +} +``` + +Transformed into: +```kotlin +package test609 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error message {}"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") +} +``` + +
+ +### error(throwable) { "error messageBuilder" } at Test610Kt.main(test610.kt:10) test + +User code: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.error(throwable) { "error messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test610 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error messageBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"") +} +``` + +### error(throwable) { "error messageBuilder $i" } at Test611Kt.main(test611.kt:10) test + +User code: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test611 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"") +} +``` + +### error(throwable) { "error messageBuilder $i ${helper()}" } at Test612Kt.main(test612.kt:10) test + +User code: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.error(throwable) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test612 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=throwable } at Test613Kt.main(test613.kt:10) test + +User code: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.atError() { message="error eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test613 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") +} +``` + +### atError() { message="error eventBuilder $i"; cause=throwable } at Test614Kt.main(test614.kt:10) test + +User code: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test614 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test615Kt.main(test615.kt:10) test + +User code: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test615 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=throwable } at Test616Kt.main(test616.kt:10) test + +User code: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test616 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + + logger.at(Level.ERROR) { message = "error eventBuilder"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } at Test617Kt.main(test617.kt:10) test + +User code: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=throwable } +} +``` + +Transformed into: +```kotlin +package test617 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } at Test618Kt.main(test618.kt:10) test + +User code: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=throwable } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test618 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + val throwable = Exception("expected!") + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; cause = throwable; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +
+ +
+ +
with throwable=false + +
with marker=true + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error(marker, "error message {}", arg) at Test619Kt.main(test619.kt:10) test + +User code: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {}", arg) +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test619 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test620Kt.main(test620.kt:10) test + +User code: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.error(marker, "error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test620 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val arg = 42 + logger.at(Level.ERROR, marker) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test621Kt.main(test621.kt:10) test + +User code: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.error(marker, "error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test621 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val a = 1; val b = 2 + logger.at(Level.ERROR, marker) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### error(marker) { "error messageBuilder" } at Test622Kt.main(test622.kt:10) test + +User code: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker) { "error messageBuilder" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test622 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i" } at Test623Kt.main(test623.kt:10) test + +User code: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i" } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test623 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker) { "error messageBuilder $i ${helper()}" } at Test624Kt.main(test624.kt:10) test + +User code: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.error(marker) { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test624 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### error(marker, "error message {}") at Test625Kt.main(test625.kt:10) test + +User code: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.error(marker, "error message {}") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test625 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +### atError(marker) { message="error eventBuilder"; cause=null } at Test629Kt.main(test629.kt:10) test + +User code: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.atError(marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test629 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i"; cause=null } at Test630Kt.main(test630.kt:10) test + +User code: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test630 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test631Kt.main(test631.kt:10) test + +User code: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.atError(marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test631 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } at Test632Kt.main(test632.kt:10) test + +User code: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message="error eventBuilder"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test632 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + + logger.at(Level.ERROR, marker) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } at Test633Kt.main(test633.kt:10) test + +User code: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i"; cause=null } +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test633 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") +} + + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +### at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } at Test634Kt.main(test634.kt:10) test + +User code: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +Transformed into: +```kotlin +package test634 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + val marker = MyMarker("markerName") + + val i = 42 + logger.at(Level.ERROR, marker) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" + +class MyMarker(private val name: String): Marker { override fun getName() = name } +``` + +
+ +
with marker=false + +
deprecated KLogger API + +
deprecated API not implemented by KLogger + +### error("error message {}", arg) at Test635Kt.main(test635.kt:10) test + +User code: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {}", arg) +} +``` + +Transformed into: +```kotlin +package test635 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") +} +``` + +### error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) at Test636Kt.main(test636.kt:10) test + +User code: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.error("error message {} " + "" + "{}" + "{}" + " abc" + " {}", arg, helper()) +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test636 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val arg = 42 + logger.at(Level.ERROR) { message = "error message 42 Hello!{} abc {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {} " + "" + "{}" + "{}" + " abc" + " {}"") +} +fun helper() = "Hello!" +``` + +### error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) at Test637Kt.main(test637.kt:10) test + +User code: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.error("error message {}a" + " {}b" + " {}ab" + " ab", a, b, ab()) +} +fun ab() = 12 +``` + +Transformed into: +```kotlin +package test637 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val a = 1; val b = 2 + logger.at(Level.ERROR) { message = "error message 1a 2b 12ab ab"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}a" + " {}b" + " {}ab" + " ab"") +} +fun ab() = 12 +``` + +
+ +### error("error message {}") at Test641Kt.main(test641.kt:10) test + +User code: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error("error message {}") +} +``` + +Transformed into: +```kotlin +package test641 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error message {}"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error message {}"") +} +``` + +
+ +### error() { "error messageBuilder" } at Test642Kt.main(test642.kt:10) test + +User code: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.error() { "error messageBuilder" } +} +``` + +Transformed into: +```kotlin +package test642 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error messageBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder"") +} +``` + +### error() { "error messageBuilder $i" } at Test643Kt.main(test643.kt:10) test + +User code: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i" } +} +``` + +Transformed into: +```kotlin +package test643 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i"") +} +``` + +### error() { "error messageBuilder $i ${helper()}" } at Test644Kt.main(test644.kt:10) test + +User code: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.error() { "error messageBuilder $i ${helper()}" } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test644 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error messageBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error messageBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### atError() { message="error eventBuilder"; cause=null } at Test645Kt.main(test645.kt:10) test + +User code: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.atError() { message="error eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test645 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") +} +``` + +### atError() { message="error eventBuilder $i"; cause=null } at Test646Kt.main(test646.kt:10) test + +User code: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test646 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") +} +``` + +### atError() { message="error eventBuilder $i ${helper()}"; cause=null } at Test647Kt.main(test647.kt:10) test + +User code: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.atError() { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test647 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +### at(Level.ERROR) { message="error eventBuilder"; cause=null } at Test648Kt.main(test648.kt:10) test + +User code: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message="error eventBuilder"; cause=null } +} +``` + +Transformed into: +```kotlin +package test648 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + + logger.at(Level.ERROR) { message = "error eventBuilder"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder"") +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i"; cause=null } at Test649Kt.main(test649.kt:10) test + +User code: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i"; cause=null } +} +``` + +Transformed into: +```kotlin +package test649 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i"") +} +``` + +### at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } at Test650Kt.main(test650.kt:10) test + +User code: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message="error eventBuilder $i ${helper()}"; cause=null } +} +fun helper() = "Hello!" +``` + +Transformed into: +```kotlin +package test650 +import io.github.oshai.kotlinlogging.* + + +fun main() { + val logger = KotlinLogging.logger {} + + + val i = 42 + logger.at(Level.ERROR) { message = "error eventBuilder 42 Hello!"; internalCompilerData = KLoggingEventBuilder.InternalCompilerData(messageTemplate = ""error eventBuilder $i ${helper()}"") +} +fun helper() = "Hello!" +``` + +
+ +
+ +
+ +
+ +
\ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 9bdc1d3e..7ddc8cc4 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,4 +1,7 @@ pluginManagement { + plugins { + id("com.diffplug.spotless") version "7.0.1" apply false + } repositories { google() gradlePluginPortal() @@ -7,3 +10,5 @@ pluginManagement { } rootProject.name = "kotlin-logging" +include(":kotlin-ir-plugin-gradle") +include(":kotlin-ir-plugin") diff --git a/src/commonMain/kotlin/io/github/oshai/kotlinlogging/internal/KLoggerInternalExtensions.kt b/src/commonMain/kotlin/io/github/oshai/kotlinlogging/internal/KLoggerInternalExtensions.kt new file mode 100644 index 00000000..b84ae3b0 --- /dev/null +++ b/src/commonMain/kotlin/io/github/oshai/kotlinlogging/internal/KLoggerInternalExtensions.kt @@ -0,0 +1,53 @@ +package io.github.oshai.kotlinlogging.internal + +import io.github.oshai.kotlinlogging.KLogger +import io.github.oshai.kotlinlogging.KLoggingEventBuilder + +public fun KLogger.entryWithCompilerData( + compilerData: KLoggingEventBuilder.InternalCompilerData? = null, + vararg arguments: Any?, +): Unit = atTrace { + message = "entry(${arguments.joinToString()})" + internalCompilerData = compilerData +} + +public fun KLogger.exitWithCompilerData( + compilerData: KLoggingEventBuilder.InternalCompilerData? = null +): Unit = atTrace { + message = "exit" + internalCompilerData = compilerData +} + +public fun KLogger.exitWithCompilerData( + compilerData: KLoggingEventBuilder.InternalCompilerData? = null, + result: T, +): T where T : Any? { + atTrace { + message = "exit($result)" + internalCompilerData = compilerData + } + return result +} + +public fun KLogger.throwingWithCompilerData( + compilerData: KLoggingEventBuilder.InternalCompilerData? = null, + throwable: T, +): T where T : Throwable { + atError { + cause = throwable + message = "throwing($throwable)" + internalCompilerData = compilerData + } + return throwable +} + +public fun KLogger.catchingWithCompilerData( + compilerData: KLoggingEventBuilder.InternalCompilerData? = null, + throwable: T, +) where T : Throwable { + atError { + cause = throwable + message = "catching($throwable)" + internalCompilerData = compilerData + } +} diff --git a/src/commonMain/kotlin/io/github/oshai/kotlinlogging/internal/MessageInvoker.kt b/src/commonMain/kotlin/io/github/oshai/kotlinlogging/internal/MessageInvoker.kt index ed8640c2..ddcc15a1 100644 --- a/src/commonMain/kotlin/io/github/oshai/kotlinlogging/internal/MessageInvoker.kt +++ b/src/commonMain/kotlin/io/github/oshai/kotlinlogging/internal/MessageInvoker.kt @@ -1,6 +1,6 @@ package io.github.oshai.kotlinlogging.internal -internal fun (() -> Any?).toStringSafe(): String { +public fun (() -> Any?).toStringSafe(): String { return try { invoke().toString() } catch (e: Exception) { @@ -15,3 +15,11 @@ internal expect object ErrorMessageProducer { internal object DefaultErrorMessageProducer { fun getErrorLog(e: Exception): String = "Log message invocation failed: $e" } + +public fun Any?.castToThrowable(): Throwable? { + return if (this is Throwable) { + this + } else { + null + } +} diff --git a/src/jvmMain/kotlin/io/github/oshai/kotlinlogging/logback/internal/LogbackLoggerFactory.kt b/src/jvmMain/kotlin/io/github/oshai/kotlinlogging/logback/internal/LogbackLoggerFactory.kt index 114814f5..058908bc 100644 --- a/src/jvmMain/kotlin/io/github/oshai/kotlinlogging/logback/internal/LogbackLoggerFactory.kt +++ b/src/jvmMain/kotlin/io/github/oshai/kotlinlogging/logback/internal/LogbackLoggerFactory.kt @@ -5,7 +5,7 @@ import ch.qos.logback.classic.LoggerContext import ch.qos.logback.classic.spi.LogbackServiceProvider import io.github.oshai.kotlinlogging.KLogger -internal object LogbackLoggerFactory { +public object LogbackLoggerFactory { private val logbackServiceProvider = createLogbackServiceProvider() @@ -22,5 +22,6 @@ internal object LogbackLoggerFactory { internal fun wrapLogbackLogger(logbackLogger: Logger): KLogger = LogbackLoggerWrapper(logbackLogger, logbackServiceProvider) - fun getLoggerContext() = logbackServiceProvider.loggerFactory as LoggerContext + public fun getLoggerContext(): LoggerContext = + logbackServiceProvider.loggerFactory as LoggerContext }