Kitten

Reference sections

Kitten has lifecycle and event logs to help you debug your apps when you use stateful components.

While some logging will automatically be enabled when you enter Kitten’s Interactive Shell (REPL), if you want to see the logs for a given section at all times, you must manually turn it on using the new LOG environment variable. e.g.,

  LOG=event,lifecycle kitten

The sectioned logs are loosely based on Node’s debuglog feature with limited support for wildcards (available only at the end of strings, so LOG='life*' will match lifecycle). You can set LOG='*' kitten to have all sections displayed.

You can also turn logging on and off and decide which sections to enable at runtime (e.g., via authored code or via the REPL), using the following methods:

MethodDescription
on()/all()Turns on all sections.
off()/none()Turns off all sections.
only(<LogKeys[]>)Turns on only the sections specified in the passed array.
listEnabled()Lists the enabled sections on the console.

The available sections that are useful for authors are:

SectionDescription
lifecyclePage and component creation, connection, removal, etc.
eventEvent log (both client and server-originating events).
routerRouter logs (can be very verbose).
verboseDetailed logs that you will rarely need.
debugFor you to use as an alternative to console.log

For detailed debugging of Kitten itself, there are also the following sections:

SectionDescription
htmlHTML renderer logs
streamingHtmlStreaming HTML sends and updates
watcherFile system watcher logs
webSocketRouteLogs from the WebSocketRoute class
pageSocketRouteLogs from the PageSocketRoute class

Beyond this, there is an internal repl section that is used by the Kitten REPL.

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.