[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-7397":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":25,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":33,"readmeContent":34,"aiSummary":35,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":36,"discoverSource":37},7397,"kotlin-logging","oshai\u002Fkotlin-logging","oshai","Lightweight Multiplatform logging framework for Kotlin. A convenient and performant logging facade.","",null,"Kotlin",3081,130,19,11,0,2,3,12,7,28.35,"Apache License 2.0",false,"master",true,[27,28,29,30,31,32],"android","jvm","kotlin","logging","multiplatform","slf4j","2026-06-12 02:01:38","# [kotlin-logging](https:\u002F\u002Fgithub.com\u002Foshai\u002Fkotlin-logging) [![CI](https:\u002F\u002Fgithub.com\u002Foshai\u002Fkotlin-logging\u002Factions\u002Fworkflows\u002Fci.yml\u002Fbadge.svg?branch=master)](https:\u002F\u002Fgithub.com\u002Foshai\u002Fkotlin-logging\u002Factions\u002Fworkflows\u002Fci.yml) [![Slack channel](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FChat-Slack-blue.svg)](https:\u002F\u002Fkotlinlang.slack.com\u002Fmessages\u002Fkotlin-logging\u002F) [![Maven Central](https:\u002F\u002Fimg.shields.io\u002Fmaven-central\u002Fv\u002Fio.github.oshai\u002Fkotlin-logging.svg)](http:\u002F\u002Fsearch.maven.org\u002F#search%7Cga%7C1%7Cg%3A%22io.github.oshai%22) [![Apache License V.2](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-Apache%20V.2-blue.svg)](https:\u002F\u002Fgithub.com\u002Foshai\u002Fkotlin-logging\u002Fblob\u002Fmaster\u002FLICENSE) [![Kotlin](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fkotlin-multiplatform-7f52ff?logo=kotlin)](https:\u002F\u002Fkotlinlang.org\u002F) [![GitHub stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Foshai\u002Fkotlin-logging?style=social)](https:\u002F\u002Fgithub.com\u002Foshai\u002Fkotlin-logging) \u003Cimg width=\"1024\" height=\"559\" alt=\"image\" src=\"https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F04d2c80d-934d-4d02-a3b2-32ad73cb8542\" \u002F>\n\nLightweight Multiplatform logging framework for Kotlin, written in \n[![Pure Kotlin](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F100%25-kotlin-blue.svg)](https:\u002F\u002Fkotlinlang.org\u002F).  \nA convenient and performant logging facade.  \n\n#### Call log methods, without checking whether the respective log level is enabled\n```Kotlin\nlogger.debug { \"Some $expensive message!\" }\n```\n\nBehind the scenes the expensive message do not get evaluated if debug is not enabled:\n```Kotlin\n\u002F\u002F This is what happens when you write the above ^^^\nif (logger.isDebugEnabled) logger.debug(\"Some $expensive message!\")\n```\n\n#### Define the logger, without explicitly specifying the class name\n```Kotlin\n\u002F\u002F Place definition above class declaration to make field static\nprivate val logger = KotlinLogging.logger {}\n```\n\nBehind the scenes `val logger` will be created in the class, with the class\u002Ffile name:\n```Kotlin\n\u002F\u002F This is what happens when you write the above ^^^\nval logger = LoggerFactory.getLogger(\"package.ClassName\")\n```\n\n#### Log exceptions in a Kotlin-style\n```Kotlin\n\u002F\u002F exception as first parameter with message as lambda\nlogger.error(exception) { \"a $fancy message about the $exception\" }\n```\n\n#### Fluent logging in a Kotlin-style\n```kotlin\nlogger.atWarn {\n    message    = \"foo $bar\"\n    cause      = exception\n    payload    = buildMap(capacity = 3) {\n        put(\"foo\", 1)\n        put(\"bar\", \"x\")\n        put(\"obj\", Pair(2, 3))\n    }\n}\n```\n\n## Getting started\n \n```Kotlin\nimport io.github.oshai.kotlinlogging.KotlinLogging\n\nprivate val logger = KotlinLogging.logger {} \n\nclass FooWithLogging {\n    val message = \"world\"\n    fun bar() {\n        logger.debug { \"hello $message\" }\n    }\n}\n```\n\n## Download\n\n**Important note:** kotlin-logging depends on slf4j-api (in the JVM artifact). In runtime, it is also required to depend on a logging implementation. More details in [how-to-configure-slf4j](http:\u002F\u002Fsaltnlight5.blogspot.co.il\u002F2013\u002F08\u002Fhow-to-configure-slf4j-with-different.html). And an excellent detailed explanation in [a-guide-to-logging-in-java](https:\u002F\u002Fwww.marcobehler.com\u002Fguides\u002Fa-guide-to-logging-in-java).  \nIn version 5 users should also provide slf4j-api dependency.\n\nIn short, if you just want to log statements to stdout, it's possible to add the following dependency: `org.slf4j:slf4j-simple:2.0.3`.\n\n### \n```xml\n\u003Cdependency>\n  \u003CgroupId>io.github.oshai\u003C\u002FgroupId>\n  \u003CartifactId>kotlin-logging-jvm\u003C\u002FartifactId>\n  \u003Cversion>7.0.3\u003C\u002Fversion>\n\u003C\u002Fdependency>\n```\n\nSee the full example in [kotlin-logging-example-maven](https:\u002F\u002Fgithub.com\u002Fmicroutils\u002Fkotlin-logging-example-maven).  \n\n### Gradle\n```Groovy\nimplementation 'io.github.oshai:kotlin-logging-jvm:7.0.3'\n```\n\n\nAlternatively, download the JAR from [github](https:\u002F\u002Fgithub.com\u002Foshai\u002Fkotlin-logging\u002Freleases\u002Flatest)  or [maven-central](https:\u002F\u002Frepo1.maven.org\u002Fmaven2\u002Fio\u002Fgithub\u002Foshai\u002F).\n\n### Multiplatform\n\nAn experimental multiplatform support is available.  \nMore information is available on the [wiki](https:\u002F\u002Fgithub.com\u002Foshai\u002Fkotlin-logging\u002Fwiki\u002FMultiplatform-support) and issues [#21](https:\u002F\u002Fgithub.com\u002Foshai\u002Fkotlin-logging\u002Fissues\u002F21) [#45](https:\u002F\u002Fgithub.com\u002Foshai\u002Fkotlin-logging\u002Fissues\u002F45).\n\n## Overview\n\nAfter seeing many questions like [Idiomatic way of logging in Kotlin](http:\u002F\u002Fstackoverflow.com\u002Fquestions\u002F34416869\u002Fidiomatic-way-of-logging-in-kotlin) and [Best practices for loggers](https:\u002F\u002Fdiscuss.kotlinlang.org\u002Ft\u002Fbest-practices-for-loggers\u002F226\u002F15), it seems like there should be a standard for logging and obtaining a logger in Kotlin. kotlin-logging provides a wrapper for slf4j-api to be used by Kotlin classes with the following advantages:\n  - No need to write the logger and class name or logger name boilerplate code.\n  - A straight forward way to log messages with lazy-evaluated string using lambda expression `{}`.\n  - All previous slf4j implementation can still be used.\n\n\n## Version 5 vs. previous versions\n\nVersion 5 is not backward compatible with previous versions (v.3, v.2, v.1). Group id (in maven) and packages names changed.\nIt is possible to use both version 5 and previous versions side-by-side so some of the code from the old version\nand some new. It is also possible to have libs using old version and use the new version (and vice-versa).  \nIn that sense it's a completely new dependency.\n\nMain changes are:\n- Maven group id changed from `io.github.microutils` -> `io.github.oshai`.\n- Root package change from `mu` -> `io.github.oshai.kotlinlogging`.\n- Slf4j dependency is not provided anymore (users have to provide it). It means that >= 5.x can work with both slf4j 1 or 2.\n- There are changes to multiplatform class hierarchy that might break compatibility.\n\nMore details in issue [#264](https:\u002F\u002Fgithub.com\u002Foshai\u002Fkotlin-logging\u002Fissues\u002F264), \nand in the [change log](https:\u002F\u002Fgithub.com\u002Foshai\u002Fkotlin-logging\u002Fblob\u002Fmaster\u002FChangeLog.md)\n\n\n\n## Who is using it\n\n- https:\u002F\u002Fwww.jetbrains.com\u002Fyoutrack\u002F (https:\u002F\u002Fwww.jetbrains.com\u002Fhelp\u002Fyoutrack\u002Fstandalone\u002FThird-Party-Software-Used-by-YouTrack.html)\n- https:\u002F\u002Fgithub.com\u002FDiUS\u002Fpact-jvm\n- https:\u002F\u002Fgithub.com\u002FAsynkronIT\u002Fprotoactor-kotlin\n- https:\u002F\u002Fgithub.com\u002Fsquare\u002Fmisk\n- https:\u002F\u002Fgithub.com\u002Fopenrndr\u002Fopenrndr\n- https:\u002F\u002Fgithub.com\u002FJetBrains\u002Fxodus\n\nAnd many more... (add your name above)\n\n## FAQ\n\n- Why not use plain slf4j? kotlin-logging has better native Kotlin support. It adds more functionality and enables less boilerplate code.\n- Is all slf4j implementation supported (Markers, params, etc')? Yes.\n- Is location logging possible? Yes, location awareness was added in kotlin-logging 1.4.\n- When I do `logger.debug`, my IntelliJ IDEA run console doesn't show any output. Do you know how I could set the console logger to debug or trace levels? Is this an IDE setting, or can it be set in the call to KLogging()? Setting log level is done per implementation. kotlin-logging and slf4j are just facades for the underlying logging lib (log4j, logback etc') more details [here](http:\u002F\u002Fstackoverflow.com\u002Fquestions\u002F43146977\u002Fhow-to-configure-kotlin-logging-logger).\n- Can I access the actual logger? In platforms available yes, via `DelegatingKLogger.underlyingLogger` property.\n\n## Usage\n\n- See [wiki](https:\u002F\u002Fgithub.com\u002Foshai\u002Fkotlin-logging\u002Fwiki) for more examples.\n\nIt is possible to configure IntelliJ live templates. For file level logger configure the following:\n- Text template: `private val logger = io.github.oshai.kotlinlogging.KotlinLogging.logger {}`.\n- Applicable in `Kotlin: top-level`.\n\n## Support\n\n- Open an issue here: https:\u002F\u002Fgithub.com\u002Foshai\u002Fkotlin-logging\u002Fissues\n- Ask a question in StackOverflow with [kotlin-logging tag](http:\u002F\u002Fstackoverflow.com\u002Ftags\u002Fkotlin-logging\u002Finfo).\n- Chat on Slack channel: https:\u002F\u002Fkotlinlang.slack.com\u002Fmessages\u002Fkotlin-logging\n- Chat on Telegram channel: https:\u002F\u002Ft.me\u002Fklogging\n\n## More links\n\n- https:\u002F\u002Fmedium.com\u002F@OhadShai\u002Flogging-in-kotlin-95a4e76388f2\n- [kotlin-logging vs AnkoLogger for Android](https:\u002F\u002Fmedium.com\u002F@OhadShai\u002Flogging-in-android-ankologger-vs-kotlin-logging-bb693671442a)\n- [How kotlin-logging was published](https:\u002F\u002Fmedium.com\u002F@OhadShai\u002Fno-forks-one-star-now-what-how-i-published-my-open-source-projects-8a5b5ae35d2c#.e3ygj6uf3)\n- [Kotlin Logging Without the Fuss](https:\u002F\u002Frealjenius.com\u002F2017\u002F08\u002F31\u002Flogging-in-kotlin\u002F)\n- [DropWizard + Kotlin = Project Kronslott](https:\u002F\u002Fmedium.com\u002F@davideriksson_91895\u002Fdropwizard-kotlin-project-kronslott-e2aa51b277b8)\n- [Logging in Kotlin – the right approach](https:\u002F\u002Famarszalek.net\u002Fblog\u002F2018\u002F05\u002F13\u002Flogging-in-kotlin-right-approach\u002F)\n- https:\u002F\u002Fbednarek.wroclaw.pl\u002Flog4j-in-kotlin\u002F\n- https:\u002F\u002Fjaxenter.com\u002Fkotlin-logging-168814.html\n\n## Contributing\n\nAny contribution is appreciated.  \n\nPull requests are welcome! See instructions in https:\u002F\u002Fgithub.com\u002Foshai\u002Fkotlin-logging\u002Fblob\u002Fmaster\u002FCONTRIBUTING.md.  \n\n[Show your ❤ with a ★](https:\u002F\u002Fgithub.com\u002Foshai\u002Fkotlin-logging\u002Fstargazers)\n\nThank you to all the developers who have contributed to kotlin-logging!\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Foshai\u002Fkotlin-logging\u002Fgraphs\u002Fcontributors\">\n  \u003Cimg src=\"https:\u002F\u002Fcontrib.rocks\u002Fimage?repo=oshai\u002Fkotlin-logging\" \u002F>\n\u003C\u002Fa>\n\n\nSee the full contributors list in: https:\u002F\u002Fgithub.com\u002Foshai\u002Fkotlin-logging\u002Fgraphs\u002Fcontributors\n\n\n\n\n","kotlin-logging 是一个为 Kotlin 设计的轻量级跨平台日志框架，提供了便捷且高效的日志门面。其核心功能包括在不检查相应日志级别是否启用的情况下调用日志方法、无需显式指定类名即可定义日志记录器以及支持以 Kotlin 风格的日志异常处理和流式日志记录。这些特性使得该库能够显著提高开发效率并减少运行时开销。适用于需要在 Android、JVM 或其他 Kotlin 支持平台上进行高效日志记录的应用场景，特别适合追求简洁代码风格和高性能的开发者使用。","2026-06-11 03:12:05","top_language"]