BitLogger Update Changes
version 1.5.0(0.11.0)
Changes
- Move async file support out of the root
srcpackage:file_sink_async(...)now returnsAsyncFileSinkfromNanaloveyuki/BitLogger/src-async, and config-built async loggers returnAsyncRuntimeSink. - Add
AsyncFileSinktosrc-asyncwith async open, write, flush, rotation, and the same policy and failure-counter surface as the synchronousFileSink. - Make deferred async file handles report a failed first open through
open_failuresand clear the unusable handle, instead of only counting write failures. - Remove the
moonbitlang/asyncdependency from the rootsrc,file_runtime,utils, andruntimecompiled closures.
Public API changes
Moved: file_sink_async
moonbit
// Nanaloveyuki/BitLogger/src-async
pub async fn file_sink_async(
path : String,
append~ : Bool = true,
auto_flush~ : Bool = true,
rotation~ : FileRotation? = None,
formatter~ : RecordFormatter = fn(rec) { format_text(rec) },
) -> AsyncFileSink- The synchronous root package no longer exports
file_sink_async, andFileSinkno longer implements the asyncSink::write_asyncoverride orflush_async. AsyncFileSinkkeeps the full synchronous control surface (policy,state,reopen*, failure counters) and addsflush_async.AsyncFileSink::reopen*remain synchronous control operations; they install a deferred handle that the next async write opens.
Changed: config-built async loggers
build_async_logger(...),build_application_async_logger(...),build_library_async_logger(...), and the parse-and-build variants now returnAsyncLogger[AsyncRuntimeSink]instead ofAsyncLogger[@runtime.RuntimeSink].AsyncRuntimeSinkkeeps the sharedRuntimeSinkcontrol, queue, and file-helper surface while routing file writes and flushes through the async backend.- A deferred file handle still reports
file_available() == truebefore its first write. A failed first open incrementsopen_failures, clears the handle, and is also counted inwrite_failures.
Verification
moon fmt --check,moon info, and strictmoon check --target TARGET --deny-warnpassed for native, wasm, wasm-gc, and js.llvmcannot be checked locally: the toolchain is missingprelude.mi.- Strict
moon test --target TARGET --deny-warnpassed: native 319, wasm 312, wasm-gc 230, js 312. src-asyncasync file tests cover async write/rotation bytes, deferred-open failure accounting, and config-built file logger writes on native.- A separate consumer module linking the local workspace wrote, rotated, and closed through
file_sink_async(...)on native. Nanaloveyuki/android_runtimebindingstill checks and tests against the local BitLogger workspace.- Android emulator smoke passed twice on
emulator-5554with an APK rebuilt from the local workspace: application Context, log priorities, Unicode, fields, target overrides, filtering, and pre-init rejection. - HarmonyOS simulator smoke passed twice on
127.0.0.1:5557with a HAP rebuilt from the local workspace: HiLog severity mapping, Unicode, fields, targets, filtering, and ArkTS-to-MoonBit calls.
Notes
moonbitlang/asyncis now reachable only throughsrc-async; the rootsrc,file_runtime,utils, andruntimecompiled closures contain no async package.- The device smokes rebuild only the downstream examples; the published registry entries still point at the previous BitLogger version until this release is published.
- Third-party dependencies and the pinned MoonBit toolchain are unchanged.