fixed logging and remove
This commit is contained in:
@@ -29,14 +29,16 @@ Non-text values are JSON-encoded automatically.
|
||||
|
||||
## Default Behavior
|
||||
|
||||
With no configuration, a default sink routes `console`, `error`, and `system` to the terminal in pretty format:
|
||||
With no configuration, a default sink routes `console`, `error`, and `system` to the terminal in pretty format. The `error` channel includes a stack trace by default:
|
||||
|
||||
```
|
||||
[a3f12] [console] main.ce:5 server started on port 8080
|
||||
[a3f12] [error] main.ce:12 connection refused
|
||||
[a3f12] [console] server started on port 8080
|
||||
[a3f12] [error] connection refused
|
||||
at handle_request (server.ce:42:3)
|
||||
at main (main.ce:5:1)
|
||||
```
|
||||
|
||||
The format is `[actor_id] [channel] file:line message`.
|
||||
The format is `[actor_id] [channel] message`. Error stack traces are always on unless you explicitly configure a sink without them.
|
||||
|
||||
## Configuration
|
||||
|
||||
@@ -114,14 +116,22 @@ File sinks write one JSON-encoded record per line. Console sinks format the reco
|
||||
|
||||
## Stack Traces
|
||||
|
||||
Add a `stack` field to a sink to capture a full call stack for specific channels. The value is an array of channel names.
|
||||
The `error` channel captures stack traces by default. To enable stack traces for other channels, add a `stack` field to a sink — an array of channel names that should include a call stack.
|
||||
|
||||
Via the CLI:
|
||||
|
||||
```bash
|
||||
pit log add terminal console --channels=console,error,debug --stack=error,debug
|
||||
```
|
||||
|
||||
Or in `log.toml`:
|
||||
|
||||
```toml
|
||||
[sink.terminal]
|
||||
type = "console"
|
||||
format = "bare"
|
||||
channels = ["console", "error"]
|
||||
stack = ["error"]
|
||||
channels = ["console", "error", "debug"]
|
||||
stack = ["error", "debug"]
|
||||
```
|
||||
|
||||
Only channels listed in `stack` get stack traces. Other channels on the same sink print without one:
|
||||
@@ -150,6 +160,7 @@ The `pit log` command manages sinks and reads log files. See [CLI — pit log](/
|
||||
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 debug console --channels=error,debug --stack=error,debug
|
||||
pit log remove terminal
|
||||
pit log read dump --lines=20 --channel=error
|
||||
pit log tail dump
|
||||
|
||||
Reference in New Issue
Block a user