Skip to content

BitLogger Update Changes ​

version 1.5.0(0.11.0)

Changes ​

  • Move async file support out of the root src package: file_sink_async(...) now returns AsyncFileSink from Nanaloveyuki/BitLogger/src-async, and config-built async loggers return AsyncRuntimeSink.
  • Add AsyncFileSink to src-async with async open, write, flush, rotation, and the same policy and failure-counter surface as the synchronous FileSink.
  • Make deferred async file handles report a failed first open through open_failures and clear the unusable handle, instead of only counting write failures.
  • Remove the moonbitlang/async dependency from the root src, file_runtime, utils, and runtime compiled 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, and FileSink no longer implements the async Sink::write_async override or flush_async.
  • AsyncFileSink keeps the full synchronous control surface (policy, state, reopen*, failure counters) and adds flush_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 return AsyncLogger[AsyncRuntimeSink] instead of AsyncLogger[@runtime.RuntimeSink].
  • AsyncRuntimeSink keeps the shared RuntimeSink control, queue, and file-helper surface while routing file writes and flushes through the async backend.
  • A deferred file handle still reports file_available() == true before its first write. A failed first open increments open_failures, clears the handle, and is also counted in write_failures.

Verification ​

  • moon fmt --check, moon info, and strict moon check --target TARGET --deny-warn passed for native, wasm, wasm-gc, and js. llvm cannot be checked locally: the toolchain is missing prelude.mi.
  • Strict moon test --target TARGET --deny-warn passed: native 319, wasm 312, wasm-gc 230, js 312.
  • src-async async 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_runtimebinding still checks and tests against the local BitLogger workspace.
  • Android emulator smoke passed twice on emulator-5554 with 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:5557 with a HAP rebuilt from the local workspace: HiLog severity mapping, Unicode, fields, targets, filtering, and ArkTS-to-MoonBit calls.

Notes ​

  • moonbitlang/async is now reachable only through src-async; the root src, file_runtime, utils, and runtime compiled 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.

Published from the repository docs folder with VitePress.