Introduction
Introduced in v5.1.23 The $log widget is a widget that can be used to output debugging information to the JavaScript console supported by most browsers.
When the widget is rendered or refreshed, the names and values of all attributes are logged to the JavaScript console.
<$log name=value />Content and Attributes
The $log widget is invisible. Any content within it is ignored.
| Attribute | Description |
|---|---|
$$filter | (Optional) All variables whose name matches the Filter Expression will be logged |
$$message | (Optional) A message to display as the title of the information logged. Useful when several $log widgets are used in sequence |
$$all | (Optional) Set to yes to log all variables |
Examples
Basic Example
Log the value of variable name, the first result of the filter expression [tag[Learning]] and the value of field created of the current tiddler:
<$log name=<<name>> filter={{{ [tag[Learning]] }}} created={{!!created}} />Example using $$filter and $$message
Log all core variables (which start with tv-) with a table title:
<$log $$message="Core Variables" $$filter="[prefix[tv-]]" />Widget Debugging
Change a misbehaving $transclude widget to a $log widget to verify that name and mode match their expected values:
<$log $variable=<<name>> $mode=<<mode>> />This application is the primary reason that the attributes of the $log widget are prefixed with two dollar signs instead of one. Otherwise, the attributes of the original widget could be interpreted as attributes to $log and lead to unintended consequences.
Example with Function
Log the tiddlerList function definition and its first evaluation result (see browser console after clicking "Try it"):
\function tiddlerList() [tag[Learning]]
<$log $$filter="[title[tiddlerList]]" value=<<tiddlerList>> />