napier-logging-kmp

Configure Napier logging behind an abstracted Logger interface in Kotlin Multiplatform projects.

Updated Sep 12, 2026
One-click install
npx skills add https://github.com/Vierco/citoVisionApp --skill napier-logging-kmp-vierco
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: napier-logging-kmp
Source: https://github.com/Vierco/citoVisionApp/tree/main/.claude/skills/napier-logging-kmp
Command: npx skills add https://github.com/Vierco/citoVisionApp --skill napier-logging-kmp-vierco

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires io.github.aakira:napier.

What problem does it solve? Kotlin Multiplatform projects need consistent, safe logging across Android, iOS, and Desktop without coupling Domain, Application, or Presentation layers to a specific logging library, and without leaking sensitive data like tokens or medical data into logs. ## Core Features & Use Cases - Abstracted Logger Interface: Defines a Logger interface in core/logging with a single NapierLogger implementation, so no layer imports Napier directly and the library can be swapped later. - Debug/Release Antilog Selection: Uses an expect/actual isDebugBuild flag per platform to choose DebugAntilog in debug and a silent or observability-backed Antilog in release. - Log Level and Sensitive Data Rules: Provides decision rules for choosing v/d/i/w/e levels and forbids logging tokens, passwords, or personal/medical data in any build. - Use Case: When catching an exception in a Repository, log it with logger.e(tag, message, throwable) before wrapping it in Result.Failure(DomainError), keeping full diagnostic context without exposing sensitive data. ## Quick Start Set up Napier logging in my Kotlin Multiplatform project with an abstracted Logger interface injected via Koin and initialized once alongside initKoin.

Frequently Asked Questions about napier-logging-kmp

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up Napier logging in a Kotlin Multiplatform project?▼

Define a Logger interface in core/logging, implement it with a NapierLogger class, and call Napier.base() once alongside your Koin initialization. Inject Logger via constructor into UseCases, Repositories, and ViewModels rather than importing Napier directly.

How do I choose the right log level in Napier?▼

Use v or d for internal debugging, i for relevant business events like successful logins, w for recoverable anomalies like retries, and e for errors affecting the user. Reserve wtf for broken invariants that should never occur.

Does Napier work on Android, iOS, and Desktop with one API?▼

Yes, Napier 2.7.x is a Kotlin Multiplatform library usable from commonMain. Platform differences are handled through an expect/actual isDebugBuild flag, with BuildConfig.DEBUG on Android and Platform.isDebugBinary on iOS.

Should I use DebugAntilog in release builds?▼

No, DebugAntilog in release leaves detailed traces accessible if the binary is inspected. Use isDebugBuild to select DebugAntilog only for debug builds, and a silent or observability-backend Antilog for release.

Can I log authentication tokens or user data for debugging?▼

No, tokens, passwords, API keys, and personal or medical data must never be logged, even at debug level in debug builds. Omit the value or replace it with a masked placeholder instead.