@@ -604,29 +604,40 @@ print : a -> IO {}
604604
605605Print a value to stdout without a trailing newline.
606606
607−### `logInfo` / `logWarn` / `logError` / `logDebug`
607+### `debug` / `info` / `warn` / `error`
608608
609609```
610−logInfo : a -> IO {}
611−logWarn : a -> IO {}
612−logError : a -> IO {}
613−logDebug : a -> IO {}
610+debug : (<>logCtx) => Text -> IO {}
611+info : (<>logCtx) => Text -> IO {}
612+warn : (<>logCtx) => Text -> IO {}
613+error : (<>logCtx) => Text -> IO {}
614614```
615615
616616Leveled logging to stderr (so output does not mix with `println` on stdout).
617617When stderr is a TTY, output is colored; otherwise each record is written as
618−one JSON line for log aggregators. `logDebug` only emits when the program is
618+one JSON line for log aggregators. `debug` only emits when the program is
619619launched with `--debug` — debug records are dropped silently otherwise. (Every
620620compiled Knot program accepts `--debug` automatically; see
621621[Runtime CLI](#runtime-cli).)
622622
623+Each logger carries a `(<>logCtx)` fold constraint: the compiler merges every
624+`logCtx` record in scope at the call site (innermost scope wins) and attaches
625+the fields as structured context, so the caller passes only the message.
626+
623627```knot
624628do
625− base.logInfo "starting"
626− base.logWarn {event "low memory" availableMb 64}
629+ base.info "starting"
630+ with {logCtx {availableMb 64}}
631+ (base.warn "low memory")
627632 yield {}
628633```
629634
635+A context field whose value contains a newline renders on a TTY as a guttered
636+block beneath the log line (single-line fields stay inline as `k=v`); in JSON
637+mode the value stays `\n`-escaped on the single emitted line.
638+
639+`logInfo`/`logWarn`/`logError`/`logDebug` are deprecated aliases.
640+
630641### `show`
631642
632643```
@@ -1309,7 +1320,7 @@ subcommands without any user wiring:
13091320
13101321| Argument | Description |
13111322|----------|-------------|
1312−| `--debug` | Enable `logDebug` output; without this flag, `logDebug` calls are dropped silently. |
1323+| `--debug` | Enable `base.debug` output; without this flag, `base.debug` calls are dropped silently. |
13131324| `--help` | Print usage including any compile-time overrides exposed by the program. |
13141325| `--http-max-body-bytes=N` | Cap HTTP request and response bodies. Suffixes: `K`, `M`, `G`. Default `16M`. Applies to both `listen` and `fetch`. |
13151326| `--<name>=<value>` | Override a compile-time constant. The compiler exposes top-level constants annotated for override; see the program's own `--help`. The same flags may be set at build time via `knot build … --<name>=<value>`. |