# Logs

```bash
spaceboy logs --project prj_... --target development
spaceboy logs --project prj_... --target production --since 7d --severity error --json
spaceboy logs --environment env_... --search "TypeError" --page-token <token>
```

`logs` reads a deployed environment's function logs from Google Cloud
Logging on demand:

- **WARNING** and worse by default; `--severity info` also returns
  info-level lines such as scheduler ticks and requests
  (`--severity warning|error` narrows). Every entry has a message: the
  text or JSON message, else the HTTP request or status, else the payload
  as compact JSON.
- `--since 24h|7d|30d` (default `24h`); `--search` filters across the log
  payloads; `nextPageToken` (stderr hint, or the `--json` field) fetches the
  next page.
- `--project` with `--target` uses the environment of the latest deploy to
  that target; `--environment` names one directly.
- Organization owners and admins only (others: exit code 4). An environment
  that has never deployed has no logs, and the command says so.

`--json` prints:

```json
{"environmentId":"env_...","entries":[{"timestamp":"2026-11-25T10:01:00Z","severity":"ERROR","serviceName":"...","message":"...","traceId":null}],"nextPageToken":null}
```

Ordinary `console.log` output is info-level: add `--severity info` to see
it.

## Not available

- Debug-level output and live tailing.
- Deploy build logs: see `spaceboy deploys --deploy <id>` for a failed
  deploy's excerpt.
- Logs of the workspace sandbox.
