📖
Rulecube documentation
v2.4
v2.4
  • Overview
  • Quick Start
  • Tutorial
    • Getting started
    • Create and Run Your First Ruleset
    • Use Constants and Methods
    • Create and Call Functions
    • Adding Testcases
    • Using Lookup Tables
    • Using Entities
    • Using Forms
  • How-to Guides
    • Logging in and Authorization
      • Activate Your Account From an Invitation
      • Log in to Rulecube
      • Change Your Password
      • Recover Your Password
      • Two-factor authentication (2FA)
      • Invite Other Users to Rulecube
      • Edit a User's Role
      • Delete a User
    • Ruleset Development
      • Create a Ruleset
      • Set the Input for a Ruleset
      • Create a Rule
      • Generate Alerts
      • Try out a Ruleset
      • Call a Ruleset from Your Software
      • Entities
        • Create an Entity
        • Drag and Drop a JSON Schema or XSD to create entities
        • Entity instantiation
        • Persisted Entities
      • Constants
        • Constant Tables
      • Functions
      • Built-in Functions
      • Create and Run a Testcase
      • Delete a Ruleset or Components
      • Debugging your Ruleset
    • Create a Workflow
      • Workflow step types
      • Working with documents in a workflow
    • Work with (Environment) Variables
    • Call a Ruleset via Its API From Postman
    • Creating input from JSON Schema
    • Use a Ruleset from Your Software
    • Ruleset Productivity Tips
    • Create an Ockto workflow
    • Alert aggregation
    • Forms
      • Introduction and overview
      • Create a Data table
  • Language Reference
    • Global
    • Array
    • Compression
    • Crypto
    • Date
    • Encryption (deprecated)
    • Finance
    • Http
    • Mail
    • MongoDB
    • Ockto
    • PDF
    • SQL
    • Statistics
    • System
    • UserStore
    • Workflow
Powered by GitBook
On this page
  1. How-to Guides
  2. Ruleset Development

Debugging your Ruleset

Tips and tricks for debugging your rulesets. Explains how console.log can be used in your code.

PreviousDelete a Ruleset or ComponentsNextCreate a Workflow

You may find yourself in a situation where you need to debug some complex logic in your code.

When you're familiar with programming in JavaScript, you'll no doubt know about console.log.

Rulecube offers a similar API! You can use console.log(), console.warn() and console.error() anywhere in your Ruleset code.

Example

Sandbox

The Sandbox offers a visualization of your Console logging below the actual result after executing.

What happens to my logs?

Your logs are returned in the execution result of the API. They are not stored on any server. The amount of log lines is also capped at a certain limit. The default is a maximum of 100 lines. This means only the last 100 lines are returned.

API call

By default, no logging is returned in the ruleset execution result. This can be changed by setting the execution options.logLevel to 'info', 'warning' or 'error'. See a Ruleset's Swagger UI page for more info (at the bottom of its Version settings).

  • 'info' - every log will be returned

  • 'warning' - only warnings and errors (console.warn() and console.error())

  • 'error' - only errors (console.error())

The API result from an execute will contain your logging in the diagnostics property. This is an array with the following object structure:

Field
Type
Description

t

number

Timestamp represented as number of milliseconds after 1970-01-01

type

string

"log", "warn" or "error"

arguments

any[]

An array of the parameters you passed to console.log() / .warn() or .error()