Skip to content

refactor: replace all println/printStackTrace logging with Kermit#245

Merged
codebutler merged 1 commit intomasterfrom
feat/kermit-logging
Feb 24, 2026
Merged

refactor: replace all println/printStackTrace logging with Kermit#245
codebutler merged 1 commit intomasterfrom
feat/kermit-logging

Conversation

@codebutler
Copy link
Owner

@codebutler codebutler commented Feb 24, 2026

Summary

  • Adopt Kermit (v2.0.8) as the KMP logging framework, replacing all ad-hoc println(), printStackTrace(), and System.err.println() calls with structured, level-filtered Logger.withTag("Tag").x { } logging
  • Add logging to ~15 silent catch (_: blocks that previously swallowed exceptions without any trace
  • Remove manual DEBUG flag in Usb4JavaPN533Transport.kt (Kermit handles log level filtering)
  • Add CLAUDE.md rule #10 documenting Kermit logging conventions

Details

51 files changed across all platforms (commonMain, androidMain, iosMain, wasmJsMain, jvmMain).

Modules touched: base/, card/ (classic, cepas, felica, ultralight, iso7816, ksx6924, vicinity), app/ (ViewModels, desktop backends, web), transit/ (erg, china, tfi-leap, troika, calypso, pilet, smartrider, bip, serialonly), flipper/.

Out of scope (unchanged): tools/mdst/ CLI utilities (intentional stdout/stderr output) and test files.

Log level mapping:

  • log.d — protocol debug traces, expected failures
  • log.i — informational status (firmware version, card detected, polling)
  • log.w — operation failures handled gracefully
  • log.e — errors indicating real problems

Test plan

  • ./gradlew allTests passes
  • Zero println() remaining in production Kotlin code (verified via grep)
  • Zero printStackTrace() remaining
  • ktlint passes (pre-commit hook)

🤖 Generated with Claude Code

Adopt Kermit (co.touchlab:kermit:2.0.8) as the KMP logging framework
across the entire codebase, replacing ad-hoc println(), printStackTrace(),
and System.err.println() calls with structured, level-filtered logging.

- Add kermit dependency to gradle/libs.versions.toml and base/build.gradle.kts
  (as api() so all downstream modules inherit it)
- Replace ~50 println() calls with Logger.withTag("Tag").x { } using
  appropriate levels (d/i/w/e)
- Replace all 5 printStackTrace() calls with log.e(throwable) { }
- Add logging to ~15 silent catch blocks (catch (_: Exception))
- Remove manual DEBUG flag in Usb4JavaPN533Transport.kt (Kermit handles
  log level filtering)
- Add CLAUDE.md rule #10 documenting Kermit logging conventions

Scope: all production Kotlin code (commonMain, androidMain, iosMain,
wasmJsMain, jvmMain). Excluded: tools/mdst/ CLI utilities and test files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codebutler codebutler merged commit dc09f6f into master Feb 24, 2026
7 checks passed
@codebutler codebutler deleted the feat/kermit-logging branch February 24, 2026 04:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant