On the twelfth day of Enhancing: Debugging
by Simon MacDonald
Original photo by Josh Sorenson on Unsplash
We are at the end of our 12 Days of Enhancing series. We’ll give you some short instructions on debugging your new Enhance application.
Since your Enhance application is running in the cloud, it’s not exactly like you can attach a debugger. Instead, we rely upon our old friend
console.log. By judicious use of
console.log we can inspect the crime scene that my code so often emulates.
To get logs from recent executions of your app, run the following command:
begin logs --env staging
That output might get a bit verbose if you have a lot of traffic. Luckily, you can filter the logs by adding a filter parameter to the command.
begin logs --env staging --filter "my keyword"
You might even want to wrap
console.log in a function so you can turn on and off the output with an environment variable like we discussed yesterday.
Take some of the tidbits we’ve given you over the past 12 days and make something great with Enhance yourself. We’d love to hear about your project. Connect in our Discord server or on Mastodon @firstname.lastname@example.org.