Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

I Missed Flutter's debugPrint After Moving to Kotlin

说明与用途

debugprint 通过在调试构建中自动启用日志、提取调用者标签并支持惰性消息,简化 Kotlin 开发日志,减少与 Android Log.d 的样板代码。

问题

Developers migrating from Flutter to Kotlin find Android's Log.d verbose and repetitive, hindering quick debugging during development.

结果

The library reduces boilerplate, automatically toggles logging per build type, derives caller information, supports lazy evaluation, and isolates logging failures from application crashes, improving developer productivity.

工作流

  • Add dependency: implementation("com.flagodna:debugprint:0.1.1")
  • Use API: debugPrint.d("Loading user...")
  • Optionally set custom tag: debugPrint.d("Auth", "Token expired")
  • Disable automatic tagging: DebugPrint.autoTag = false
  • Use lazy messages: debugPrint.d{ "User: ${expensiveOperation()}" }
  • Replace sink if needed: DebugPrint.sink = CustomSink()

证据

I built one. GitHub: https://github.com/cas8398/debugprint

来源

debugPrint.d("Loading user...")

来源

debugPrint automatically enables logging for debug builds and disables it for release builds.

来源

debugPrint.d{ "User: ${expensiveOperation()}" }

来源

  • 记录日期: 2026-10-02T17:41:12.116Z