Files
2026-05-12 16:06:00 +08:00

2.2 KiB

name, group, category, update-time, description, key-word
name group category update-time description key-word
logger-debug api logging 20260512 Emit a debug-level record through the logger using the debug severity shortcut.
logger
debug
sync
public

Logger-debug

Emit a debug-level record through the synchronous logger. This is the convenience wrapper for log(Level::Debug, ...).

Interface

pub fn[S : Sink] Logger::debug(self : Logger[S], message : String, fields~ : Array[Field] = []) -> Unit {}

input

  • self : Logger[S] - Logger that should emit the debug record.
  • message : String - Debug message text.
  • fields : Array[Field] - Optional structured fields attached to the record.

output

  • Unit - No return value. The record is handled according to the logger threshold and sink pipeline.

Explanation

Detailed rules explaining key parameters and behaviors

  • This helper delegates to log(Level::Debug, ...).
  • Debug logging is useful for development diagnostics that are usually too verbose for normal production visibility.
  • Per-call target override is not exposed here; use log(...) for that level of control.
  • All logger wrappers remain active exactly as they would for the base log(...) path.

How to Use

Here are some specific examples provided.

When Need Internal State Diagnostics

When implementation details should be observable during debugging:

logger.debug("cache refreshed")

In this example, the call site signals a development-focused diagnostic event.

When Attach Structured Debug Fields

When a debug event should carry explicit state:

logger.debug("session loaded", fields=[field("user_id", "42")])

In this example, the logger emits structured state without using the fully explicit log(...) form.

Error Case

e.g.:

  • If the logger minimum level is above Debug, the call returns without writing a record.

  • If the event needs a custom target override, use log(...) instead of this shortcut.

Notes

  1. Prefer this helper when debug intent is more readable than a raw log(Level::Debug, ...) call.

  2. Use is_enabled(Level::Debug) when building the debug payload is expensive.