24 Apr 2023: Logging in Stacks

Nathan Begbie Updated by Nathan Begbie

We know that with all coding endevours, you sometimes need to be able to debug and Stacks are no exception!

To make this easier, we've introduced the log function, which allows you to log information within the Stacks simulator, so that you don't have to keep adding and removing `text` functions to understand how your Stack is behaving!

card TextAndLogMessage do

text("Hello this is my first text.")

log("a simple message")

text("Hello this is my second text.")


However, you can also use it to log more complicated data structures, such as the dictionary below. You could also log structures such as @contact, made available within the chat.

card LogData do





Will result in the following:

There are two things to note about the log function.

  1. You need to pass in a string. If you want to evaluate a more complicated structure like `contacts`, you need to use an expression - so use log("@contact"), not log(contact). The Stack will highlight this issue as an error if you attempt to do this.
  2. They currently only works within the Stacks simulator. They will not affect interactions when using a Stack directly via WhatsApp.
  3. These logs are temporary. They will disappear each time you start a new session with the Stacks simulator

We hope this aids you in your journey to creating impactful stacks and services!

Was this article helpful?

15 May 2023: The latest Canvas improvements

20 Apr 2023: The no-code Canvas is live!