Print Log
In this section, we will learn how to use the Print Log block.
Use Cases
During software development, logging is a crucial aspect as it provides valuable insights into the state of the program, helps identify issues, and optimize performance.
Similarly, when building workflows in Tapicker, logging allows you to verify if a workflow is executed correctly. That's the purpose of this block.
This will output the following log:
[2024-10-13T13:27:12.402] INFO (Engine): NodePrintLog(1f331b84) Hello World!
For simplicity in the following examples, we will omit the date prefix.
Printing Variable Values
Suppose @vars.name = "Anna"
. You can print its value as follows:
Name: {{@vars.name}}
This will output the following log:
Name: Anna
Printing Arrays
Example 1: When @vars.array = [ 1, 2, 3 ]
{{@vars.array}} // 1, 2, 3
Example 2: When @vars.array = [ {"name": 1}, {"name": 2}, {"name": 3} ]
{{@vars.array}} // [object Object],[object Object],[object Object]
You’ll notice that you can't see the actual content of the objects. You need to convert the array to a string using the toString()
function.
{{@vars.array|toString()}} // [{"name":1},{"name":2},{"name":3}]
Printing JSON
Example 1: When @vars.json = { "name": 123 }
{{@vars.json}} // [object Object]
Again, to view the content, use the toString()
function to convert it to a string.
{{@vars.json|toString()}} // {"name":123}