--- name: library-logger-info group: api category: facade update-time: 20260613 description: Emit an info-level record through a LibraryLogger facade by delegating to the wrapped logger's info shortcut. key-word: - library - facade - info - public --- ## Library-logger-info Emit an info-level record through the library-facing sync logger. This is the convenience wrapper for `log(Level::Info, ...)` on `LibraryLogger[S]`. ### Interface ```moonbit pub fn[S : Sink] LibraryLogger::info( self : LibraryLogger[S], message : String, fields~ : Array[Field] = [], ) -> Unit { ``` #### input - `self : LibraryLogger[S]` - Library-facing logger that should emit the info record. - `message : String` - Informational message text. - `fields : Array[Field]` - Optional structured fields attached to the record. #### output - `Unit` - No return value. The record is handled according to the current threshold and wrapped sink pipeline. ### Explanation Detailed rules explaining key parameters and behaviors - This helper delegates to `info(...)` on the wrapped logger, which in turn uses `log(Level::Info, ...)`. - `Info` is the default minimum logger threshold unless changed explicitly. - This helper does not accept a per-call target override. It uses the facade's stored target unless the facade was derived earlier with `with_target(...)` or `child(...)`. - Any existing sink wrappers inside the logger pipeline still participate normally in the write path. - The library facade keeps the same write semantics while exposing a smaller public surface. - Broader composition helpers remain on the underlying `Logger[S]` and require `to_logger()` first. ### How to Use Here are some specific examples provided. #### When Emit Normal Library Lifecycle Events When a package should report standard lifecycle milestones: ```moonbit logger.info("service started") ``` In this example, the event uses normal informational severity through the narrower facade. #### When Attach Structured Informational Context When an info event should include machine-readable metadata: ```moonbit logger.info("request completed", fields=[field("status", "200")]) ``` In this example, the event remains concise while still carrying useful fields. And any shared context already carried by the facade still participates through the wrapped logger pipeline. And the write still uses the facade's stored target because this shortcut does not take a one-off `target=` override. ### Error Case e.g.: - If the logger minimum level is above `Info`, the call returns without writing a record. - If the event needs an explicit alternate target, use `log(...)` instead of this shortcut. - If callers need broader composition helpers after logging, they must unwrap first with `to_logger()`. ### Notes 1. This is the common convenience method for normal library-facing events. 2. Because `Info` is often the default threshold, this helper is a natural baseline for facade examples. 3. Use `log(...)` instead when the call site needs a per-call target override or a dynamic level.