or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

configuration.mdindex.mdlevels-and-control.mdlogger-implementations.mdoutput-formatting.md
tile.json

tessl/maven-io-ktor--ktor-client-logging-linuxx64

Kotlin multiplatform HTTP client logging plugin for LinuxX64 target that provides comprehensive request and response logging capabilities.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/io.ktor/ktor-client-logging-linuxx64@3.2.x

To install, run

npx @tessl/cli install tessl/maven-io-ktor--ktor-client-logging-linuxx64@3.2.0

index.mddocs/

Ktor Client Logging

Ktor Client Logging is a multiplatform HTTP client plugin that provides comprehensive request and response logging capabilities for LinuxX64 and other targets. It offers configurable detail levels, multiple output formats, header sanitization, and platform-specific logger integrations.

Package Information

  • Package Name: ktor-client-logging-linuxx64
  • Package Type: maven
  • Language: Kotlin
  • Installation: Implementation provided as part of Ktor Client plugins
  • Coordinates: io.ktor:ktor-client-logging-linuxx64:3.2.0

Core Imports

import io.ktor.client.plugins.logging.*

For HttpClient installation:

import io.ktor.client.*
import io.ktor.client.plugins.logging.*

Basic Usage

import io.ktor.client.*
import io.ktor.client.plugins.logging.*

// Install logging plugin with basic configuration
val client = HttpClient {
    install(Logging) {
        level = LogLevel.HEADERS
        logger = Logger.DEFAULT
    }
}

// Or with custom configuration
val client = HttpClient {
    install(Logging) {
        level = LogLevel.ALL
        format = LoggingFormat.OkHttp
        logger = Logger.SIMPLE
        
        // Filter requests
        filter { request -> 
            request.url.host.contains("api.example.com")
        }
        
        // Sanitize sensitive headers
        sanitizeHeader { headerName -> 
            headerName == "Authorization"
        }
    }
}

Architecture

The Ktor Client Logging plugin is built around several key components:

  • Plugin Configuration: LoggingConfig class provides DSL-based configuration options
  • Logging Levels: LogLevel enum controls what information gets logged (INFO, HEADERS, BODY, ALL, NONE)
  • Output Formats: LoggingFormat enum supports Default and OkHttp-style formatting
  • Logger Interface: Abstraction supporting multiple platform-specific implementations
  • Request/Response Processing: Internal pipeline integration for transparent logging
  • Content Observation: Smart binary detection and content type handling

Capabilities

Plugin Installation and Configuration

Core plugin installation with comprehensive configuration options including levels, formats, filtering, and header sanitization.

val Logging: ClientPlugin<LoggingConfig>

fun HttpClientConfig<*>.Logging(block: LoggingConfig.() -> Unit = {})

Plugin Configuration

Logging Levels and Control

Control what information gets logged with granular level settings and request filtering capabilities.

enum class LogLevel(val info: Boolean, val headers: Boolean, val body: Boolean) {
    ALL(true, true, true),
    HEADERS(true, true, false),
    BODY(true, false, true),
    INFO(true, false, false),
    NONE(false, false, false)
}

Logging Levels and Control

Logger Implementations

Platform-specific logger implementations providing integration with system logging frameworks.

interface Logger {
    fun log(message: String)
    companion object
}

val Logger.Companion.DEFAULT: Logger
val Logger.Companion.SIMPLE: Logger  
val Logger.Companion.EMPTY: Logger

Logger Implementations

Output Formatting

Multiple output format options for compatibility with different logging tools and preferences.

enum class LoggingFormat {
    Default,
    OkHttp
}

Output Formatting