登录 注册

kotlin-logging

去点 Star
其他
3,113
Stars
—
Forks
0
Watchers
—
Open Issues
待补全
许可证
Kotlin
语言
—
创建时间
最近更新

项目能做什么

轻量级 Kotlin 跨平台日志框架,提供便捷高性能的日志门面。
来源:AI 基于仓库事实生成 · 内容以仓库实际 README 为准

使用说明 查看原始 README 原仓库文档

中文使用说明暂未生成。下面保留原仓库 README 摘录,命令与配置均以原文为准。
原始 README 摘录(英文原文,节选前 3000 字符)
# [kotlin-logging](https://github.com/oshai/kotlin-logging) [![CI](https://github.com/oshai/kotlin-logging/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/oshai/kotlin-logging/actions/workflows/ci.yml) [![Slack channel](https://img.shields.io/badge/Chat-Slack-blue.svg)](https://kotlinlang.slack.com/messages/kotlin-logging/) [![Maven Central](https://img.shields.io/maven-central/v/io.github.oshai/kotlin-logging.svg)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22io.github.oshai%22) [![Apache License V.2](https://img.shields.io/badge/license-Apache%20V.2-blue.svg)](https://github.com/oshai/kotlin-logging/blob/master/LICENSE) [![Kotlin](https://img.shields.io/badge/kotlin-multiplatform-7f52ff?logo=kotlin)](https://kotlinlang.org/) [![GitHub stars](https://img.shields.io/github/stars/oshai/kotlin-logging?style=social)](https://github.com/oshai/kotlin-logging) <img width="1024" height="559" alt="image" src="https://github.com/user-attachments/assets/04d2c80d-934d-4d02-a3b2-32ad73cb8542" />

Lightweight Multiplatform logging framework for Kotlin, written in 
[![Pure Kotlin](https://img.shields.io/badge/100%25-kotlin-blue.svg)](https://kotlinlang.org/).  
A convenient and performant logging facade.  

#### Call log methods, without checking whether the respective log level is enabled
```Kotlin
logger.debug { "Some $expensive message!" }
```

Behind the scenes the expensive message do not get evaluated if debug is not enabled:
```Kotlin
// This is what happens when you write the above ^^^
if (logger.isDebugEnabled) logger.debug("Some $expensive message!")
```

#### Define the logger, without explicitly specifying the class name
```Kotlin
// Place definition above class declaration to make field static
private val logger = KotlinLogging.logger {}
```

Behind the scenes `val logger` will be created in the class, with the class/file name:
```Kotlin
// This is what happens when you write the above ^^^
val logger = LoggerFactory.getLogger("package.ClassName")
```

#### Log exceptions in a Kotlin-style
```Kotlin
// exception as first parameter with message as lambda
logger.error(exception) { "a $fancy message about the $exception" }
```

#### Fluent logging in a Kotlin-style
```kotlin
logger.atWarn {
    message    = "foo $bar"
    cause      = exception
    payload    = buildMap(capacity = 3) {
        put("foo", 1)
        put("bar", "x")
        put("obj", Pair(2, 3))
    }
}
```

## Getting started
 
```Kotlin
import io.github.oshai.kotlinlogging.KotlinLogging

private val logger = KotlinLogging.logger {} 

class FooWithLogging {
    val message = "world"
    fun bar() {
        logger.debug { "hello $message" }
    }
}
```

## Download

**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://saltnlight5.blogspot.co.il/2013/08/how-to-configure-slf4j-with-different.html). And an excellent det
阅读完整原文

项目深度分析 AI 生成

Kotlin 专用日志增强与敏感数据脱敏 Gradle/Compiler 插件 (SaaS/On-Premise 授权)

产品构想利用 Kotlin 编译器插件(K2/IR)或字节码插桩,针对 kotlin-logging 的 Fluent API 和 Lambda 日志进行编译期静态分析、敏感字段自动脱敏、无用日志去除(优化生产包体积)以及结构化参数自动提取。
核心功能编译期日志脱敏与语法检查、动态日志级别远程控制插桩、生产构建剥离特定等级日志、日志格式标准化静态校验。
目标用户中大型金融、电商、医疗等合规要求极高的 Kotlin/Android/JVM 研发团队及架构师。
难度/周期高 · 3-6个月 · 成本:开发机器、多版本 Kotlin 编译器适配测试集群成本、销售与合规验证成本。
收费模式企业授权许可(按应用/开发者席位年费付费)、支持定制规则与报告服务。
竞争风险Kotlin 编译器 API(K2)变更频繁导致维护成本高;企业对第三方编译插件有安全顾虑。
依据 已验证事实

KMP 跨平台全栈统一日志与可观测性 SDK/后端(开箱即用套件)

产品构想结合 kotlin-logging 的 multiplatform facade 特性,封装适配 iOS、Android、Desktop、Web 的轻量级本地日志滚动存储与远程上报引擎,提供即插即用的轻量收集后台/开发调试 Dashboard。
核心功能支持 iOS/Android/JVM 的统一日志落盘与加密上传、本地离线日志打包导出、网络状态自适应上报、简易日志排查 Web 后台。
目标用户采用 Kotlin Multiplatform 技术栈的中小型移动端或全栈开发团队。
难度/周期中等 · 2-4个月 · 成本:云端多租户服务架构成本、日志存储与网络带宽开销。
收费模式免费额度 + 按上报日志量计费的 SaaS 订阅,或私有化部署一键包买断。
竞争风险市场上有成熟的 Datadog、Sentry 等巨头 APM 方案,直接竞争压力大。
依据 尚需验证的假设

IntelliJ IDEA / Android Studio 日志分析与规范辅助商业插件

产品构想为 JetBrains IDE 提供围绕 kotlin-logging 的高效开发工具,包括动态生成最佳实践日志模板、性能反模式告警(如非延迟评估误用)、实时日志语法高亮、内联结构化日志快速排查等功能。
核心功能日志代码异味检测(如缺少上下文、未使用 Lambda)、代码重构建议、IDE 内与后端日志关联快速跳转、团队日志格式统一模板分发。
目标用户追求高开发规范与效率的 Kotlin 工程师及技术团队。
难度/周期中等 · 1-2个月 · 成本:JetBrains Marketplace 开发者账号注册费用及维护精力。
收费模式JetBrains Marketplace 付费订阅制(Freemium,高级静态检查与团队配置功能收费)。
竞争风险用户付费意愿偏弱(偏好免费内置 Inspect 规则);产品体量偏小,变现天花板有限。
依据 AI推测
AI 基于仓库公开数据分析生成,含推测成分,不构成收益承诺。
报告会保存到 个人中心

竞品与相似项目 GitHub Search 真实检索

相似项目数据正在完善中,暂不展示(避免误导)

项目优势与风险

技术成熟度创建时间待补全,最近推送 ,发布过 100 个 Release
社区活跃Star 3,113 / Fork 0 / Issue 0(数据支持,可自行核实)
许可证未检测到(需人工确认)
主要风险上游项目方向可能变化;同赛道竞争者较多(见竞品表);热度与需求不完全等价

安装与使用

此项目未提供 Docker 镜像,安装步骤以原仓库 README 为准(涉及依赖安装与环境配置,对新手门槛较高)。