[logging]
The Rust server's log format: human-readable text, or one JSON object per line for log shippers.
gio.toml
[logging]
format = "json"Reference
| Key | Default | Description |
|---|---|---|
format"text" | "json" | "text" | "text": human-readable lines with colors. "json": one object per line with ts (RFC 3339, UTC), level, msg and target, plus the event's fields and those of its spans - every line logged for a request carries request_id. Any other value stops startup. |
Behavior
GIO_LOG_FORMAT(jsonortext, any case) wins over the file, so one build can log text locally and JSON in its container. An invalid value is ignored with a warning:ignoring GIO_LOG_FORMAT="logfmt": expected "json" or "text".- The Node worker always writes JSON lines with the same core keys and the request id as
requestId; this key only switches the server's own lines. - Levels are filtered with
RUST_LOGfor the server (defaultinfo) andGIO_LOG_LEVELfor the worker.
text
{"ts":"2026-10-06T12:00:01.204518Z","level":"info","msg":"request completed","target":"giojs_server","cache":"miss","method":"GET","path":"/posts/7","request_id":"0b8e3c52-7a1d-4f0e-9c3b-5d2a6e8f1a47","status":"200"}Examples
JSON in production, text locally
Leave gio.toml at the default and set the variable where the logs are shipped:
Dockerfile
ENV GIO_LOG_FORMAT=jsonGood to know
format = "logfmt"stops startup:invalid `logging.format`: unknown variant `logfmt`, expected `text` or `json`.- Event or span fields named
ts,level,msgortargetare written asfield.<name>instead of overwriting the core keys.
Related
Version history
| Version | Changes |
|---|---|
v0.1.0-beta.8 | Introduced, with GIO_LOG_FORMAT. |