From the course: Rust Programming: Beginner to Advanced

Unlock this course with a free trial

Join today to access over 26,200 courses taught by industry experts.

Using println! and logging

Using println! and logging

We're continuing a series on debugging in Rust with a focus on two essential techniques, using println and logging. These tools are the bread and butter of debugging for both beginners and experienced developers. Whether you're just getting started or looking to deepen your understanding, this video will walk you through how to effectively use println for quick debugging, and how to set up more sophisticated logging in your Rust applications. Let's start with the basics using println. We know println is a macro in Rust that prints text to the console. It's incredibly useful for quick and dirty debugging because it allows you to output the value of variables or track the flow of your program. Let's look at a simple println example. Over here, we have a println statement printing the value of x and y. These lines output the value of x and y variables to the console. And it's a quick way to see what's happening inside your program and what are the values of variables. So, what can be the…

Contents