diff --git a/.editorconfig b/.editorconfig index aab17e9e..392fe661 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,7 +8,6 @@ max_line_length = 150 ; Tab indentation (no size specified) indent_style = space charset = utf-8 -indent_size = 4 [*.yml] indent_size = 2 diff --git a/src/commonMain/kotlin/io/github/oshai/kotlinlogging/KLogger.kt b/src/commonMain/kotlin/io/github/oshai/kotlinlogging/KLogger.kt index 109fba4e..6a821e46 100644 --- a/src/commonMain/kotlin/io/github/oshai/kotlinlogging/KLogger.kt +++ b/src/commonMain/kotlin/io/github/oshai/kotlinlogging/KLogger.kt @@ -109,25 +109,40 @@ public interface KLogger { } /** Lazy add a log message with throwable payload if isTraceEnabled is true */ - public fun atTrace(marker: Marker? = null, block: KLoggingEventBuilder.() -> Unit): Unit = + public fun atTrace(marker: Marker?, block: KLoggingEventBuilder.() -> Unit): Unit = at(Level.TRACE, marker, block) + /** Lazy add a log message with throwable payload if isTraceEnabled is true */ + public fun atTrace(block: KLoggingEventBuilder.() -> Unit): Unit = at(Level.TRACE, null, block) + /** Lazy add a log message with throwable payload if isDebugEnabled is true */ - public fun atDebug(marker: Marker? = null, block: KLoggingEventBuilder.() -> Unit): Unit = + public fun atDebug(marker: Marker?, block: KLoggingEventBuilder.() -> Unit): Unit = at(Level.DEBUG, marker, block) + /** Lazy add a log message with throwable payload if isDebugEnabled is true */ + public fun atDebug(block: KLoggingEventBuilder.() -> Unit): Unit = at(Level.DEBUG, null, block) + /** Lazy add a log message with throwable payload if isInfoEnabled is true */ - public fun atInfo(marker: Marker? = null, block: KLoggingEventBuilder.() -> Unit): Unit = + public fun atInfo(marker: Marker?, block: KLoggingEventBuilder.() -> Unit): Unit = at(Level.INFO, marker, block) + /** Lazy add a log message with throwable payload if isInfoEnabled is true */ + public fun atInfo(block: KLoggingEventBuilder.() -> Unit): Unit = at(Level.INFO, null, block) + /** Lazy add a log message with throwable payload if isWarnEnabled is true */ - public fun atWarn(marker: Marker? = null, block: KLoggingEventBuilder.() -> Unit): Unit = + public fun atWarn(marker: Marker?, block: KLoggingEventBuilder.() -> Unit): Unit = at(Level.WARN, marker, block) + /** Lazy add a log message with throwable payload if isWarnEnabled is true */ + public fun atWarn(block: KLoggingEventBuilder.() -> Unit): Unit = at(Level.WARN, null, block) + /** Lazy add a log message with throwable payload if isErrorEnabled is true */ - public fun atError(marker: Marker? = null, block: KLoggingEventBuilder.() -> Unit): Unit = + public fun atError(marker: Marker?, block: KLoggingEventBuilder.() -> Unit): Unit = at(Level.ERROR, marker, block) + /** Lazy add a log message with throwable payload if isErrorEnabled is true */ + public fun atError(block: KLoggingEventBuilder.() -> Unit): Unit = at(Level.ERROR, null, block) + /** Lazy add a log message if level enabled */ public fun at(level: Level, marker: Marker? = null, block: KLoggingEventBuilder.() -> Unit) diff --git a/src/javaMain/kotlin/io/github/oshai/kotlinlogging/slf4j/internal/LocationAwareKLogger.kt b/src/javaMain/kotlin/io/github/oshai/kotlinlogging/slf4j/internal/LocationAwareKLogger.kt index 3dbeec27..b1b1e9b6 100644 --- a/src/javaMain/kotlin/io/github/oshai/kotlinlogging/slf4j/internal/LocationAwareKLogger.kt +++ b/src/javaMain/kotlin/io/github/oshai/kotlinlogging/slf4j/internal/LocationAwareKLogger.kt @@ -271,15 +271,27 @@ internal class LocationAwareKLogger(override val underlyingLogger: LocationAware override fun atDebug(marker: Marker?, block: KLoggingEventBuilder.() -> Unit): Unit = at(Level.DEBUG, marker, block) + /** Lazy add a log message with throwable payload if isDebugEnabled is true */ + override fun atDebug(block: KLoggingEventBuilder.() -> Unit): Unit = at(Level.DEBUG, null, block) + /** Lazy add a log message with throwable payload if isInfoEnabled is true */ override fun atInfo(marker: Marker?, block: KLoggingEventBuilder.() -> Unit): Unit = at(Level.INFO, marker, block) + /** Lazy add a log message with throwable payload if isInfoEnabled is true */ + override fun atInfo(block: KLoggingEventBuilder.() -> Unit): Unit = at(Level.INFO, null, block) + /** Lazy add a log message with throwable payload if isWarnEnabled is true */ override fun atWarn(marker: Marker?, block: KLoggingEventBuilder.() -> Unit): Unit = at(Level.WARN, marker, block) + /** Lazy add a log message with throwable payload if isWarnEnabled is true */ + override fun atWarn(block: KLoggingEventBuilder.() -> Unit): Unit = at(Level.WARN, null, block) + /** Lazy add a log message with throwable payload if isErrorEnabled is true */ override fun atError(marker: Marker?, block: KLoggingEventBuilder.() -> Unit): Unit = at(Level.ERROR, marker, block) + + /** Lazy add a log message with throwable payload if isErrorEnabled is true */ + override fun atError(block: KLoggingEventBuilder.() -> Unit): Unit = at(Level.ERROR, null, block) } diff --git a/versions.gradle.kts b/versions.gradle.kts index b7f0e927..2b1f4132 100644 --- a/versions.gradle.kts +++ b/versions.gradle.kts @@ -1,4 +1,4 @@ -extra["slf4j_version"] = "2.0.6" +extra["slf4j_version"] = "2.0.9" extra["coroutines_version"] = "1.6.4" extra["log4j_version"] = "2.22.0" extra["mockito_version"] = "4.11.0"