Because KRL rulesets run in the cloud, it can often be difficult to know just how to go about debugging them.
First, read Tips for Developers.
Using the Sky Event Console
The Sky Event Console is a Chrome application that raises events directly to the Sky API.
Once you do, the console looks like this:
You can enter the event domain and type, a token, and any event attributes.
- Clicking on the “Raise Event” button at the bottom raises the event to the specified event engine for the user identified by the token.
- Any rule sets that are salient for the given event are executed and the results are returned and show at the bottom.
- Clicking the “Debug” button shows the debug results.
- The console saves your last inputs from invocation to invocation. You can also easily see the raw response, response headers, request body, and request headers.
To use the Sky API, also need to know how to get an event channel identifier (ECI) for your pico. You can retrieve the primary, OAuth ECI for the account using the About function of the KRL Developer Tools application.
Using the Pico Logger
The KRL Developer Tools application uses the built-in pico logging system to show logging data from events raised to a pico. The logging page looks like this:
Normally logging is turned off. Flip the switch to enable it. Once enabled, any event sent to the pico and any query made to a ruleset in the pico will be logged.
The log data shows the execution of rules and functions relevant to the event raised or query made. Each line contains
- milliseconds since the process started
- logging level (INFO, WARN, ERROR)
- ruleset ID, if applicable
- rule name, if applicable
- logging message
logstatement, and the
klog()operator to send logging data to a error processing rule.
Refreshbutton to refresh the list of logs. The
Clearbutton clears the logs.