Dev Tools
Run basil --dev and the server turns on its development conveniences: live reload, detailed error pages, a log panel, and a database inspector.
Live Reload
Every page served in dev mode polls for changes; save a handler and the browser refreshes itself. Combined with no build step, the loop is: edit → save → look.
Error Pages
In dev mode, a failing handler renders a detailed error page — the error class and code, the source line with a caret, and hints. In production, visitors get a generic error page instead (details go to the logs).
The Dev Log
Log from any handler with @basil/log — entries land in the dev panel, not your HTML:
let {dev} = import @basil/log
dev.log(someValue)
dev.log("user", currentUser)
dev.log("uh oh", err, {level: "error"}) // "info" | "warn" | "error"
Every dev.* function is a no-op in production and in plain pars, so it's safe to leave the calls in.
Dev logs are stored in SQLite (configurable):
dev:
log_database: ./logs/dev_logs.db
log_max_size: 10MB
log_truncate_pct: 25
Database Inspector
Dev mode serves a web UI at /__/db for the built-in database: browse tables, run ad-hoc queries, download tables as CSV, and upload CSVs back.
Request Logging
Requests are logged to the configured output (logging.output); use --quiet to silence them. Handler log() output goes to logging.parsley.output.
Dev Mode vs Production
basil --dev |
basil |
|
|---|---|---|
| Protocol | HTTP on localhost | HTTPS (see Deployment) |
| Live reload | ✓ | — |
| Error pages | Detailed | Generic |
| Response caching | Off (configurable) | On |
| Dev log & inspector | ✓ | — |
See Also
- Running Basil — flags and profiles
- Configuration — the
devandloggingsections