Skip to main content

log

This function prints its argument (message) to the server log console. It is used for debugging.

Options

The log function can take arguments of any type.

tip
If a json object is passed to it, it will be printed to the log console in its entirety, with every field printed out.

How to use

For example, the log function can be used to track current values of variables and object attributes:

// $session.codes = ["XeZ4","o09E","sadL"];
state: GetPromoCode
q!: want * get * promo code
a: Your promo code is {{ $session.codes.splice(0, 1) }}
script:
log("Promo codes left: " + $session.codes.length);

Then the expected log console output will be:

2018-11-15 14:49:43,123 INFO [js] - Promo codes left: 2