Skip to content

avelon1A/network-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Network Logger SDK (KMP)

A premium, Chucker-inspired network monitoring tool for Kotlin Multiplatform projects. It provides a real-time UI to inspect HTTP and WebSocket traffic with advanced metrics and a dashboard.

� Installation

Ensure you have mavenCentral() in your root build.gradle.kts or settings.gradle.kts:

repositories {
    mavenCentral()
}

Version Catalog (libs.versions.toml)

[versions]
network-logger = "1.0.0"

[libraries]
network-logger = { module = "io.github.avelon1a:network-logger", version.ref = "network-logger" }

Build File (build.gradle.kts)

dependencies {
    implementation(libs.network.logger)
}

�🚀 Quick Start (Android)

1. Initialize the SDK

Initialize the logger in your Application class to enable the persistent notification launcher.

class MyApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        NetworkLoggerProvider.logger.initialize(this)
    }
}

2. Install Ktor Interceptor

Add the NetworkLoggerPlugin to your Ktor HttpClient.

val client = HttpClient {
    install(NetworkLoggerPlugin) {
        logger = NetworkLoggerProvider.logger
        filter = { request -> 
            !request.url.toString().contains("analytics.com")
        }
    }
}

3. Log WebSocket Activity

Use the WebSocketLogger bridge for manual WebSocket tracking.

val wsLogger = WebSocketLogger(NetworkLoggerProvider.logger)

// In your WebSocket listener
wsLogger.logConnected(url)
wsLogger.logMessageReceived(url, text)
wsLogger.logMessageSent(url, text)

✨ Features

  • 🔔 Access: Persistent notification with a live request counter for instant access from any screen.
  • 📊 Advanced Metrics: Dedicated dashboard with success rate, latency trends (line chart), and traffic density (bar chart).
  • 🎨 Premium UI: Modern Indigo/Teal aesthetic with dark mode support and glassmorphism elements.
  • 🔍 Deep Inspection: View full request/response headers and bodies with status-colored badges.
  • 📈 Performance Insights: Automatically identifies and highlights the slowest endpoints in your application.

🛠 Project Structure

  • commonMain: Core logic, data structures, and the main UI (Compose Multiplatform).
  • androidMain: Android-specific initialization, Notification Launcher, and Standalone Activity.
  • iosMain: iOS-specific hooks (ready for implementation).

Built with ❤️ for Kotlin Multiplatform development.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages