Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Latest commit

 

History

History
39 lines (26 loc) · 871 Bytes

README.md

File metadata and controls

39 lines (26 loc) · 871 Bytes

wisp-logging

Convenience functions on top of kotlin-logging.

Usage

MDC

Use this library to easily set MDC per log entry:

private val logger = getLogger<LoggingTest>()

logger.info(
  "user-id" to "blerb", 
  "alias-id" to "d6F1EF53"
) { "tagged info" }

Otherwise, this library falls back to kotlin-logging:

logger.info { "some logs" }

Log Sampling

Use this library to sample down the volume of logs produced the logger:

private val logger = getLogger<LoggingTest>().sampled()

By default, this will logger will be rate limited to 1 log per second, but a custom Sampler can be provided if a different rate or policy is required:

private val logger = getLogger<LoggingTest>().sampled(Sampler.rateLimiting(500L))