Skip to content

BitLogger Update Changes ​

version 1.4.0(0.10.0)

Changes ​

  • Add Logger::log_with for typed fallible record writers; preserve existing Sink and Logger::log contracts.

Public API changes ​

Added: Logger::log_with ​

moonbit
pub fn[S, E] Logger::log_with(
  self : Logger[S],
  level : Level,
  message : String,
  write : (S, Record) -> Result[Unit, E],
  fields~ : Array[Field] = [],
  target~ : String = "",
) -> Result[Unit, E]
  • Accepts any stored sink S, without a Sink trait constraint, and a synchronous writer with typed result E.
  • Applies the minimum level before constructing the record or invoking the writer. A filtered call returns Ok(()) and does not capture a timestamp.
  • Preserves level, message, per-call fields, default/per-call target, and optional timestamp in the record. Returns the writer's Ok or Err unchanged.
  • Dispatches through the supplied writer; it does not automatically traverse context, filter, patch, fanout, or queue wrappers. A writer must understand the stored wrapper if one is used.
  • No existing public signatures were changed or removed. Sink::write and Logger::log remain non-raising.

See the dedicated API reference for parameters and usage.

Verification ​

  • moon fmt --check and moon info passed.
  • Strict moon check --target TARGET --deny-warn and moon test --target TARGET --deny-warn passed: native 312 tests, wasm 312, wasm-gc 230, js 312.
  • Explicit src-async strict checks/tests passed on native, wasm, wasm-gc, and js: 108, 108, 26, and 108 tests respectively.
  • Native smoke runs passed for basic, console_basic, config_build, presets, text_formatter, style_tags, file_rotation, and async_basic.

Notes ​

  • Third-party dependencies and the pinned MoonBit toolchain are unchanged.
  • Publication excludes local logs/, database files, and database sidecars without deleting them from the working tree.

Published from the repository docs folder with VitePress.