Change Ktor log level to INFO and add 'HttpClient' tag to KermitHttpLogger

This commit is contained in:
James Rich
2026-05-23 16:09:52 -05:00
parent 4f57e65097
commit 059ee976c9
6 changed files with 7 additions and 10 deletions

View File

@@ -33,7 +33,7 @@ git submodule update --init
KMP modules have different task names than pure-Android modules. Using the wrong name silently skips tests or fails resolution.
| Intent | KMP modules (`core:*`, `feature:*`) | Android-only (`app`, `core:api`, `core:barcode`) |
| Intent | KMP modules (`core:*`, `feature:*`) | Android-only (`app`, `core:barcode`) |
|--------|--------------------------------------|--------------------------------------------------|
| Run tests | `:module:allTests` | `:module:testFdroidDebugUnitTest` |
| Detekt | `:module:detekt` (lifecycle task) | `:module:detekt` |

View File

@@ -45,7 +45,7 @@ jobs:
fi
- name: Publish to GitHub Packages
run: ./gradlew :core:api:publish :core:model:publish :core:proto:publish
run: ./gradlew :core:model:publish :core:proto:publish
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -112,7 +112,7 @@ jobs:
- name: Lint, Analysis & KMP Smoke Compile
if: inputs.run_lint == true
run: ./gradlew spotlessCheck detekt androidApp:lintFdroidDebug androidApp:lintGoogleDebug core:barcode:lintFdroidDebug core:barcode:lintGoogleDebug core:api:lintDebug kmpSmokeCompile -Pci=true --continue
run: ./gradlew spotlessCheck detekt androidApp:lintFdroidDebug androidApp:lintGoogleDebug core:barcode:lintFdroidDebug core:barcode:lintGoogleDebug kmpSmokeCompile -Pci=true --continue
- name: KMP Smoke Compile (lint skipped)
if: inputs.run_lint == false

View File

@@ -111,7 +111,7 @@ class NetworkModule {
if (buildConfigProvider.isDebug) {
install(plugin = Logging) {
logger = KermitHttpLogger
level = LogLevel.BODY
level = LogLevel.INFO
}
}
}

View File

@@ -20,8 +20,7 @@ import co.touchlab.kermit.Logger
import io.ktor.client.plugins.logging.Logger as KtorLogger
/**
* Bridges Ktor's HTTP client logging to [Kermit][Logger] so HTTP request/response events appear in the standard app
* logs rather than going to [System.out] via Ktor's default [io.ktor.client.plugins.logging.Logger.DEFAULT].
* Bridges Ktor's HTTP client logging to [Kermit][Logger].
*
* Usage:
* ```
@@ -34,7 +33,5 @@ import io.ktor.client.plugins.logging.Logger as KtorLogger
* ```
*/
object KermitHttpLogger : KtorLogger {
override fun log(message: String) {
Logger.d { message }
}
override fun log(message: String) = Logger.withTag("HttpClient").d { message }
}

View File

@@ -229,7 +229,7 @@ private fun desktopPlatformStubsModule() = module {
if (DesktopBuildConfig.IS_DEBUG) {
install(Logging) {
logger = KermitHttpLogger
level = LogLevel.BODY
level = LogLevel.INFO
}
}
}