Skip to content

Commit

Permalink
remove default params from overloads
Browse files Browse the repository at this point in the history
add override methods in location aware.
  • Loading branch information
oshai committed Nov 27, 2023
1 parent 472d736 commit e24cf73
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 7 deletions.
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
25 changes: 20 additions & 5 deletions src/commonMain/kotlin/io/github/oshai/kotlinlogging/KLogger.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
2 changes: 1 addition & 1 deletion versions.gradle.kts
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit e24cf73

Please sign in to comment.