Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Remove old link, warn about error handling, add klog better

...

The syntax of an explicit logging expression is:

Code Block
languagejavascript
themeConfluence
<expr>.klog(<message>)
, which returns the value of <expr> after logging the value.

where <expr> is any valid KRL expression. The expression is returned, and something like the following is added to the console log (and the "Logging" tab of the UI if enabled):

Code Block
languagejavascript
themeConfluence
[KLOG] <message> <expr converted to a string>


The syntax of an explicit logging statement is:

...

where <level> is one of info, warn, error, or debug; and <expr> is any valid KRL expression that results in a string (or something that can be cast as a string such as a number). Explicit logging places statements also place the log message in two places:

...

the console

...

log, and the "Logging" tab of the UI if

...

enabled.

The following example would place a string with the value of a variable named query in the log if the rule fired:

...

Another approach to logging would use explicit error handling.See Debugging KRL for more information on debugging tools.  (not yet implemented).