2.0 KiB
name, group, category, update-time, description, key-word
| name | group | category | update-time | description | key-word | ||||
|---|---|---|---|---|---|---|---|---|---|
| global-debug | api | global | 20260512 | Emit a debug-level record through the shared default logger shortcut. |
|
Global-debug
Emit a debug-level record through the shared default logger. This is the global convenience wrapper for log(Level::Debug, ...).
Interface
pub fn debug(message : String, fields~ : Array[Field] = []) -> Unit {}
input
message : String- Debug message text.fields : Array[Field]- Optional structured fields attached to the record.
output
Unit- No return value. The record is handled through the shared default logger.
Explanation
Detailed rules explaining key parameters and behaviors
- This helper delegates to
default_logger().debug(...). - The record uses the current shared minimum level and target configuration.
- Debug output is typically intended for development and troubleshooting.
- This helper is best suited to small apps or code paths that intentionally rely on the shared logger.
How to Use
Here are some specific examples provided.
When Need Simple Global Debug Logging
When code wants quick diagnostics without wiring a logger variable:
set_default_min_level(Level::Debug)
debug("cache refreshed")
In this example, the shared global path starts accepting debug records.
When Attach Structured Debug Context
When a debug event should include machine-readable detail:
debug("session loaded", fields=[field("user_id", "42")])
In this example, the global shortcut still supports structured fields.
Error Case
e.g.:
-
If the shared minimum level is above
Debug, the record is skipped. -
If different modules need distinct targets or sinks, a shared global debug path may be too coarse.
Notes
-
Prefer explicit loggers once application logging becomes subsystem-specific.
-
Use
set_default_min_level(...)before expecting global debug output to appear.