# 03 · structured-log **演示**:把 level/message/字段拼成一行 JSON。 **运行时**:`lua54`、`luajit`。 **运行**: ```sh .tools/bin/lua54 scripts/run-example.lua examples/27-debugging-and-observability/03-structured-log .tools/bin/lua54 scripts/test-example.lua examples/27-debugging-and-observability/03-structured-log ``` **预期输出**(lua 5.4.9 / macOS arm64;字段顺序不保证): ```text {"level":"info","message":"started","request_id":"r-1"} ``` **看点**:结构化日志便于检索;字段值必须转义。 **注意**:生产用成熟编码器,避免手写转义遗漏。