# Logging `deft/stdext/logging` provides `debug` / `info` / `warn` / `error` macros that wrap the built-in `log/*` functions. Because filtering happens at compile time, a disabled level compiles to nothing — no call, no branch, no string building.
require "deft/stdext/logging"
Use `require`, not `import`: macros are a compile-time construct and the `require`d module's `$log-level` must be visible to the compiler when it expands the call sites. ## Macros | Macro | Expands to | Enabled when level is | |---|---|---| | `[debug …]` | `[log/debug …]` | `debug` | | `[info …]` | `[log/info …]` | `debug`, `info` | | `[warn …]` | `[log/warn …]` | `debug`, `info`, `warn` | | `[error …]` | `[log/error …]` | `debug`, `info`, `warn`, `error` | Each macro appends the call site (`file:line:col`) to the message.
require "deft/stdext/logging"

[info "loaded " $path " in " $duration "ms"]
[warn "disk usage at " $pct "%"]
[error "something broke"]
[debug "x=" $x " y=" $y]
## Log Level The level is read once from `DEFT_LOG_LEVEL` at module load (default `"debug"`). Accepted values are `debug`, `info`, `warn`, `error`, and `off` / `none`. Changing it requires a reload/restart. The built-in `log/*` functions and bare `log` are not level-filtered and always write; `log/info` / `log/warn` / `log/error` reach the TUI error console while `log/debug` goes to the log file only. ## See Also - Logging (manual) — `log/*` destinations and runtime semantics - Macros — `macro/compile-when` and macro fundamentals