Prepare 0.4.1 release documentation

This commit is contained in:
Nanaloveyuki
2026-05-12 10:37:43 +08:00
parent f609b02377
commit a328414087
6 changed files with 60 additions and 6 deletions
+19 -1
View File
@@ -6,6 +6,15 @@ BitLogger is a structured logging library written in MoonBit.
BitLogger currently provides:
## Backend Compatibility
| Module / capability | native / llvm | js / wasm / wasm-gc |
| --- | --- | --- |
| `bitlogger` core package | Supported | Supported |
| `file_sink(...)` | Supported | Not available, `native_files_supported()` returns `false` |
| `bitlogger_async` | Native worker semantics | Compatibility implementation |
| `examples/async_basic` | Supported | Not shipped currently because `async fn main` entry support is still limited |
- log levels: `Trace`, `Debug`, `Info`, `Warn`, `Error`
- structured key-value fields
- plain console output
@@ -331,8 +340,17 @@ match logger.file_runtime_state() {
- `shutdown()` is now the recommended way to stop the async worker. By default it waits for the queue to drain, closes the queue, and then waits for the worker to exit.
- Basic lifecycle observability is also available through `is_closed()`, `is_running()`, `has_failed()`, and `last_error()`.
- The async worker now supports batched queue draining via `max_batch` and basic flush policies through `flush=Never|Batch|Shutdown`.
- `async_runtime_mode()`, `async_runtime_mode_label(...)`, and `async_runtime_supports_background_worker()` expose whether the current backend is using the native worker path or the compatibility implementation.
- `async_runtime_state_to_json(...)` and `stringify_async_runtime_state(...)` make it easy to include the current async runtime mode in startup diagnostics or health output.
- The recommended startup pattern is shown in [examples/async_basic/main.mbt](/E:/repo/MooLiteyukiBot/examples/async_basic/main.mbt:1).
- This layer currently targets `native/llvm` only and remains isolated from the synchronous logger core.
- `bitlogger_async` now compiles across multiple targets: `native/llvm` keeps the background worker semantics, while `js` / `wasm` / `wasm-gc` use a compatibility implementation.
- Because `moonbitlang/async` still limits `async fn main` entry support, the `examples/async_basic` executable remains `native`-only for now.
Startup diagnostic example:
```moonbit
println(stringify_async_runtime_state(async_runtime_state(), pretty=true))
```
### Async Config
-3
View File
@@ -3,7 +3,6 @@
version 0.4.0
### Feature
- feat: add `ColorMode = Never | Auto | Always` for text formatter color control
- feat: add ANSI level, target, timestamp, and field rendering to `format_text(...)`
- feat: add `color_mode` to `TextFormatter` and `TextFormatterConfig`
@@ -22,7 +21,6 @@ version 0.4.0
- feat: add `ColorSupport = Basic | TrueColor` and support `sink.text_formatter.color_support` so hex / RGB styles can downgrade to basic ANSI colors
### Test
- test: cover ANSI text formatter rendering in `Always` mode
- test: cover `Auto` mode fallback behavior when `NO_COLOR` is present
- test: cover config parsing and serialization for `color_mode`
@@ -43,7 +41,6 @@ version 0.4.0
- docs: add runtime and JSON examples for toggling style markup parsing
### Notes
- `Auto` currently uses a conservative rule: if `NO_COLOR` exists, ANSI is disabled; otherwise ANSI is enabled
- inline style markup supports both short close `</>` and named closing tags like `</red>`
- unknown or invalid inline tags currently fall back to plain text and do not raise formatter errors
+19
View File
@@ -0,0 +1,19 @@
## BitLogger Update Changes
version 0.4.1
### Feature
- feat: make `bitlogger_async` compile on `js` / `wasm` / `wasm-gc` via a compatibility backend instead of abort-only stubs
- feat: add `async_runtime_mode()` and related helpers so callers can explicitly detect native-worker vs compatibility async behavior
- feat: add `AsyncRuntimeState` JSON/stringify helpers for exposing async runtime mode in diagnostics
### Test
- test: cover async logger compatibility backend queue drain behavior and keep async config roundtrip available on non-native targets
- test: cover async runtime capability helper consistency across backend-specific implementations
### Notes
- `bitlogger_async` now provides a compatibility implementation on non-native targets; the standalone async example remains `native`-only because `async fn main` entry support is still toolchain-limited
- `examples/async_basic` now prints the current async runtime state at startup so downstream projects have a minimal diagnostic pattern to copy