Reference sections
Reference › Logs
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:
| Method | Description |
|---|---|
| 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:
| Section | Description |
|---|---|
| lifecycle | Page and component creation, connection, removal, etc. |
| event | Event log (both client and server-originating events). |
| router | Router logs (can be very verbose). |
| verbose | Detailed logs that you will rarely need. |
| debug | For you to use as an alternative to console.log |
For detailed debugging of Kitten itself, there are also the following sections:
| Section | Description |
|---|---|
| html | HTML renderer logs |
| streamingHtml | Streaming HTML sends and updates |
| watcher | File system watcher logs |
| webSocketRoute | Logs from the WebSocketRoute class |
| pageSocketRoute | Logs from the PageSocketRoute class |
Beyond this, there is an internal repl section that is used by the Kitten REPL.