Kitten

Technical Manual sections

For error pages, exit codes, and restarts, see Errors and restarts.

kitten.log (src/lib/log.ts) is a set of loggers, one per section:

The LOG environment variable turns sections on. It is a comma-separated list of section names, where * turns on every section and a name that ends in * turns on every section that starts with the rest of the name (e.g., LOG=page* turns on pageSocketRoute). While Kitten runs, the kitten.log.all(), kitten.log.none(), and kitten.log.only() methods turn sections on and off. (on() and off() are aliases of all() and none().)

Inside Kitten, log with a section logger instead of console.info(), and use console.warn() and console.error() for what must always show. (This applies to Kitten itself, not to apps.)

src/REPL.ts starts once the server is listening. When Kitten’s standard output is a terminal, pressing s opens a Node.js REPL (read–eval–print loop) in the server’s process, and Ctrl C quits Kitten. Otherwise (e.g., under systemd), you connect with the shell command.

Both shells have these commands:

The shell saves its history in repl/history.txt in the app’s data directory (kitten.paths.APP_REPL_DIRECTORY). While a shell is open, the kitten.__replIsActive property is true.

Source code:

Like this? Fund us!

Small Technology Foundation is a tiny, independent not-for-profit.

We exist in part thanks to patronage by people like you. If you share our vision and want to support our work, please become a patron or donate to us today and help us continue to exist.