feat: add wasmWasi target with console appender and tests #551
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary Adds WebAssembly WASI (wasmWasi) target to kotlin-logging, reusing directMain logic and providing a simple console appender.
Motivation Enable kotlin-logging usage in WASI runtimes (e.g. wasmtime, Node.js WASI, future serverless/Wasm hosts) with minimal setup, consistent with existing wasmJs and native behavior.
Key Changes
Gradle: added wasmWasi target (with nodejs() environment) + source sets (wasmWasiMain / wasmWasiTest).
New actuals for wasmWasi:
KotlinLoggingConfiguration (simple mutable properties)
ConsoleOutputAppender (stdout println for all levels except OFF)
KLoggerNameResolver (mirrors wasmJs stacktrace-based resolver)
Tests: SimpleWasmWasiTest (basic logging + OFF level check)
Changelog: unreleased note about wasmWasi support.
Design Notes
Uses println (no stderr separation; WASI stderr mapping can be added later if needed).
Reuses directMain API surface; no public API changes.
Keeps implementation minimal to reduce maintenance burden.
Node.js runtime declared to satisfy current Gradle/WASM DSL expectations.
Testing
Compiled wasmWasi main & tests (compileKotlinWasmWasi / compileTestKotlinWasmWasi succeeded).
Did not run full build due to missing Android SDK in current environment (pre-existing constraint).
Logic mirrors existing wasmJs test patterns minus JS console interception.
Backward Compatibility
No breaking changes; new target only.
Existing platforms unaffected.