Package-level declarations

Types

Link copied to clipboard
interface Copyable<out T : Copyable<T>>
Link copied to clipboard
open class SampledLogger(val underlyingLogger: KLogger, sampler: Sampler) : KLogger
Link copied to clipboard
@ExperimentalMiskApi
object SmartTagsThreadLocalHandler
Link copied to clipboard
typealias Tag = Pair<String, Any?>

Functions

Link copied to clipboard
fun KLogger.debug(vararg tags: Tag, message: () -> Any?)
fun KLogger.debug(th: Throwable, vararg tags: Tag, message: () -> Any?)
Link copied to clipboard
fun KLogger.error(vararg tags: Tag, message: () -> Any?)
fun KLogger.error(th: Throwable, vararg tags: Tag, message: () -> Any?)
Link copied to clipboard
inline fun <T> getLogger(): KLogger
Link copied to clipboard
fun KLogger.info(vararg tags: Tag, message: () -> Any?)
fun KLogger.info(th: Throwable, vararg tags: Tag, message: () -> Any?)
Link copied to clipboard
fun KLogger.log(level: Level, vararg tags: Tag, message: () -> Any?)
fun KLogger.log(level: Level, th: Throwable, vararg tags: Tag, message: () -> Any?)
Link copied to clipboard
fun KLogger.sampled(sampler: Sampler = Sampler.rateLimiting(1L)): KLogger

Returns a logger that samples logs. This logger MUST be instantiated statically, in a companion object or as a Singleton.

Link copied to clipboard
fun KLogger.trace(vararg tags: Tag, message: () -> Any?)
fun KLogger.trace(th: Throwable, vararg tags: Tag, message: () -> Any?)
Link copied to clipboard
fun KLogger.warn(vararg tags: Tag, message: () -> Any?)
fun KLogger.warn(th: Throwable, vararg tags: Tag, message: () -> Any?)
Link copied to clipboard
@ExperimentalMiskApi
fun <T> withSmartTags(vararg tags: Tag, block: () -> T): T

Use this function to add tags to the MDC context for the duration of the block.

Link copied to clipboard
fun <T> withTags(vararg tags: Tag, block: () -> T): T

fun <T> withTags(vararg tags: Tag, includeTagsOnExceptionLogs: Boolean = false, block: () -> T): T

includeTagsOnExceptionLogs: For usage instructions, please see docs below on withSmartTags