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 aSinktrait constraint, and a synchronous writer with typed resultE. - 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
OkorErrunchanged. - 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::writeandLogger::logremain non-raising.
See the dedicated API reference for parameters and usage.
Verification
moon fmt --checkandmoon infopassed.- Strict
moon check --target TARGET --deny-warnandmoon test --target TARGET --deny-warnpassed: native 312 tests, wasm 312, wasm-gc 230, js 312. - Explicit
src-asyncstrict 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, andasync_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.