From 797b15d9a76b4cb3bdeafcc2289d6382514b526c Mon Sep 17 00:00:00 2001 From: Neeme Praks Date: Sun, 27 Oct 2024 22:49:06 +0200 Subject: [PATCH] Introduce internalCompilerData field --- .../github/oshai/kotlinlogging/KLoggingEventBuilder.kt | 10 +++++++++- .../logback/internal/LogbackLoggerWrapper.kt | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/commonMain/kotlin/io/github/oshai/kotlinlogging/KLoggingEventBuilder.kt b/src/commonMain/kotlin/io/github/oshai/kotlinlogging/KLoggingEventBuilder.kt index 33d0675..3d5355c 100644 --- a/src/commonMain/kotlin/io/github/oshai/kotlinlogging/KLoggingEventBuilder.kt +++ b/src/commonMain/kotlin/io/github/oshai/kotlinlogging/KLoggingEventBuilder.kt @@ -2,7 +2,15 @@ package io.github.oshai.kotlinlogging public class KLoggingEventBuilder { public var message: String? = null - public var messageTemplate: String? = null public var cause: Throwable? = null public var payload: Map? = null + public var internalCompilerData: InternalCompilerData? = null + + public class InternalCompilerData( + public val messageTemplate: String? = null, + public val className: String? = null, + public val methodName: String? = null, + public val lineNumber: Int? = null, + public val fileName: String? = null, + ) } diff --git a/src/jvmMain/kotlin/io/github/oshai/kotlinlogging/logback/internal/LogbackLoggerWrapper.kt b/src/jvmMain/kotlin/io/github/oshai/kotlinlogging/logback/internal/LogbackLoggerWrapper.kt index a30d958..0f25618 100644 --- a/src/jvmMain/kotlin/io/github/oshai/kotlinlogging/logback/internal/LogbackLoggerWrapper.kt +++ b/src/jvmMain/kotlin/io/github/oshai/kotlinlogging/logback/internal/LogbackLoggerWrapper.kt @@ -30,7 +30,7 @@ internal class LogbackLoggerWrapper( fqcn = fqcn, logger = underlyingLogger, level = level.toLogbackLevel(), - message = messageTemplate ?: message, + message = internalCompilerData?.messageTemplate ?: message, finalFormattedMessage = message, throwable = cause, argArray = emptyArray(),