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

I Missed Flutter's debugPrint After Moving to Kotlin

Description and use

debugprint simplifies development logging in Kotlin by auto‑enabling logs in debug builds, deriving caller tags, and supporting lazy messages, reducing boilerplate compared to Android’s Log.d.

Problem

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

Outcome

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.

Workflow

  • 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()

Evidence

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

Source

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

Source

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

Source

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

Source

  • Record date: 2026-10-02T17:41:12.116Z