diff --git a/docs/actors.md b/docs/actors.md index d8c3262e..15043661 100644 --- a/docs/actors.md +++ b/docs/actors.md @@ -111,6 +111,18 @@ $stop() // stop self $stop(child) // stop a child actor ``` +**Important:** `$stop()` does not halt execution immediately. Code after the call continues running in the current turn — it only prevents the actor from receiving future messages. Structure your code so that nothing runs after `$stop()`, or use `return` to exit the current function first. + +```javascript +// Wrong — code after $stop() still runs +if (done) $stop() +do_more_work() // this still executes! + +// Right — return after $stop() +if (done) { $stop(); return } +do_more_work() +``` + ### $start(callback, program) Start a new child actor from a script. The callback receives lifecycle events: diff --git a/docs/library/json.md b/docs/library/json.md index 45adcc94..fc6df2d9 100644 --- a/docs/library/json.md +++ b/docs/library/json.md @@ -15,10 +15,14 @@ var json = use('json') ### json.encode(value, space, replacer, whitelist) -Convert a value to JSON text. +Convert a value to JSON text. With no `space` argument, output is pretty-printed with 1-space indent. Pass `false` or `0` for compact single-line output. ```javascript json.encode({a: 1, b: 2}) +// '{ "a": 1, "b": 2 }' + +// Compact (no whitespace) +json.encode({a: 1, b: 2}, false) // '{"a":1,"b":2}' // Pretty print with 2-space indent @@ -32,7 +36,7 @@ json.encode({a: 1, b: 2}, 2) **Parameters:** - **value** — the value to encode -- **space** — indentation (number of spaces or string) +- **space** — indentation: number of spaces, string, or `false`/`0` for compact output. Default is pretty-printed. - **replacer** — function to transform values - **whitelist** — array of keys to include diff --git a/docs/logging.md b/docs/logging.md index 02a7f470..1bb6b871 100644 --- a/docs/logging.md +++ b/docs/logging.md @@ -66,7 +66,7 @@ exclude = ["console"] |-------|--------|-------------| | `type` | `"console"`, `"file"` | Where output goes | | `format` | `"pretty"`, `"bare"`, `"json"` | How output is formatted | -| `channels` | array of names, or `["*"]` | Which channels this sink receives | +| `channels` | array of names, or `["*"]` | Which channels this sink receives. Quote `'*'` on the CLI to prevent shell glob expansion. | | `exclude` | array of names | Channels to skip (useful with `"*"`) | | `path` | file path | Output file (file sinks only) | @@ -118,7 +118,7 @@ The `pit log` command manages sinks and reads log files. See [CLI — pit log](/ ```bash pit log list # show sinks pit log add terminal console --format=bare --channels=console -pit log add dump file .cell/logs/dump.jsonl --channels='*' --exclude=console +pit log add dump file .cell/logs/dump.jsonl '--channels=*' --exclude=console pit log remove terminal pit log read dump --lines=20 --channel=error pit log tail dump