# oshai/kotlin-logging

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/oshai-kotlin-logging).**

3,086 stars · 130 forks · Kotlin · Apache-2.0

## Links

- GitHub: https://github.com/oshai/kotlin-logging
- awesome-repositories: https://awesome-repositories.com/repository/oshai-kotlin-logging.md

## Topics

`android` `jvm` `kotlin` `logging` `multiplatform` `slf4j`

## Description

kotlin-logging is a logging facade for Kotlin that provides a unified API and a multiplatform logging interface. It functions as a wrapper for various backend frameworks, including SLF4J, to enable consistent event recording across different JVM and Kotlin Multiplatform targets.

The library centers on lazy message evaluation, which prevents expensive string construction unless the specific log level is active. This is achieved through a lazy-evaluated logger that computes messages only when the current severity level permits.

The project supports structured application logging with metadata and exceptions, automatic logger initialization based on the surrounding class, and native backend routing to redirect output to platform-specific logging systems. It also includes global log level configuration to control message emission across the system.

## Tags

### Programming Languages & Runtimes

- [Kotlin Multiplatform Logging](https://awesome-repositories.com/f/programming-languages-runtimes/kotlin-multiplatform-logging.md) — Provides a unified logging interface for recording events and errors across different Kotlin Multiplatform targets.
- [Lazy Evaluation](https://awesome-repositories.com/f/programming-languages-runtimes/deferred-execution/lazy-evaluation.md) — Uses lambda-based lazy evaluation to avoid expensive string construction for suppressed log levels.
- [Logging Facades](https://awesome-repositories.com/f/programming-languages-runtimes/language-ecosystems-tooling/kotlin-extensions/logging-facades.md) — Provides a concise Kotlin-idiomatic facade for various backend logging frameworks.

### Development Tools & Productivity

- [Deferred Log Evaluation](https://awesome-repositories.com/f/development-tools-productivity/logging-libraries/deferred-log-evaluation.md) — Improves performance by delaying log argument evaluation until the required severity level is confirmed.

### Operating Systems & Systems Programming

- [Platform Support](https://awesome-repositories.com/f/operating-systems-systems-programming/platform-development-integration/platform-support.md) — Provides a single unified interface for recording events across diverse operating systems and environments. ([source](https://cdn.jsdelivr.net/gh/oshai/kotlin-logging@master/README.md))

### Software Engineering & Architecture

- [Platform-Specific Backend Resolution](https://awesome-repositories.com/f/software-engineering-architecture/cross-platform-development/multiplatform-code-sharing/expectation-based-compilers/platform-specific-backend-resolution.md) — Uses Kotlin's expect-actual mechanism to resolve the correct logging backend at compile time for different operating systems.
- [Multiplatform Logging Interfaces](https://awesome-repositories.com/f/software-engineering-architecture/cross-platform-development/multiplatform-code-sharing/multiplatform-logging-interfaces.md) — Offers a unified logging bridge that works across different JVM and Kotlin Multiplatform targets.
- [Facades](https://awesome-repositories.com/f/software-engineering-architecture/facades.md) — Implements a unified API facade that forwards logging calls to various backend frameworks.

### System Administration & Monitoring

- [Cross-Platform Logging Modules](https://awesome-repositories.com/f/system-administration-monitoring/application-performance-monitoring-platforms/cross-platform-monitors/cross-platform-logging-modules.md) — Routes application logs to native system logging backends across various environments and platforms.
- [Log Configuration](https://awesome-repositories.com/f/system-administration-monitoring/log-configuration.md) — Includes global log level configuration to define minimum severity thresholds for the entire system. ([source](https://github.com/oshai/kotlin-logging/wiki/Multiplatform-support))
- [Native Tracing Backend Integrations](https://awesome-repositories.com/f/system-administration-monitoring/performance-tracing-platforms/native-tracing-backend-integrations.md) — Redirects output to platform-specific logging systems to ensure messages appear in native system logs. ([source](https://github.com/oshai/kotlin-logging/wiki/Multiplatform-support))
- [Structured Logging](https://awesome-repositories.com/f/system-administration-monitoring/structured-logging.md) — Supports creating detailed log entries with metadata and exceptions for structured analysis.
- [Logging Abstractions](https://awesome-repositories.com/f/system-administration-monitoring/system-logging-frameworks/logging-abstractions.md) — Provides a lightweight abstraction that integrates with SLF4J and other backend logging frameworks.
