Log Array
The Log Array node allows you to log an array of data to the console for debugging purposes. It’s a useful tool for inspecting the contents of an array at any point in your spell’s execution.Inputs
flow(required): The input flow that triggers the node to execute.text(optional): A custom message to include in the log output. Defaults to an empty string.severity(optional): The severity level of the log message. Can be “info”, “warning”, or “error”. Defaults to “info”.payload(required): The array of data to log to the console.
Outputs
flow: The output flow after the array has been logged.
Configuration
This node has no additional configuration options.Usage
- Connect the input flow to the
flowinput port. This determines when the node will execute. - (Optional) Provide a custom message to the
textinput to add context to the log output. - (Optional) Set the
severityinput to “info”, “warning”, or “error” to indicate the importance of the log message. - Connect the array you want to log to the
payloadinput port. - Connect the
flowoutput port to the next node in your spell.
Example
Here’s an example of how you might use the Log Array node in a spell:value property is greater than 10, and log the filtered array with the message “Filtered data”.
By strategically placing Log Array nodes, we can inspect the data at different stages of processing and ensure the spell is working as expected.
Best Practices
- Use clear, descriptive messages in the
textinput to make it easier to understand the purpose of each log statement. - Set the
severityinput to “warning” or “error” for logs that indicate potential problems. - Remove or disable Log Array nodes before deploying your spell to production to avoid cluttering the console.
Common Issues
- Forgetting to connect the
payloadinput will result in an empty array being logged. - Logging very large arrays can make the console output difficult to read. Consider filtering or limiting the data before logging if needed.
