...
When a block runs, its full output response (as shown in the Response tab) is automatically logged and stored by Canvas . The logged output can be indexed for easy searching for 30 days.
In this article we will explain how you can configure the logging to suit your needs, by using a search model.Canvas also enables for easy searching, or with in-code logging using the helper function logger.log()
See also the related article for how to search the stored logs: Searching logs
Info |
---|
|
...
|
...
|
...
|
...
|
In this article we will describe how to set up a search model, and how to use logger.log() for custom logging.
See also the related article for how to search the stored logs: Searching logs
Setting up a block Search Model
To set up a search model, select the block you want to log information for, and head to the Response tab.
...
When you click the icon you will be presented with a hierarchy of fields, based on the response that was last outputted by the block. (You may need to run the block first, to generate an output response.)
Here you can select the fields you wish to be able to search in the logs:
...
In this case we have selected the “badgeNo” field, which will let us search for the all block responses where the badgeNo was present.In the screenshot we selected the “badgeNo”, “givenName”, and “familyName” fields. This will ensure that these three fields are searchable in the logs going forward (logs created after the search model was defined).
Press the Save icon after making your selections. 💾
When you search the logs (using search option “By response”) you will see the fields you selected as options in the search settings:
...
See this article for info on how to search stored logs: Searching logs
Using logger.log()
The logger.log() function can be used in the code for any block. The function accepts both strings and objects, but objects will be stringified. Null and undefined values will be logged as empty strings.
...