Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Write Better Python Buggy Logs Logging

In what situation should I need to capture a debug level message? What would be a good example of a debug message?

I understand the practice and process of Logging, but I don't understand when to use debug or how a debug message would look like. How is debug different than info?

1 Answer

A developer would normally use Debug level messages for logging messages that help them find issues in their code. For example, we would log variables and their values or on an exception we can log the exception type and message and where it came from. So that we can "Debug" our code if anything seems wrong.

Most users will not get any value out of these messages as they normally relate directly to pieces of code and the state of the code at certain times. This is why we use the Info, Warning and Error level messages to give information back to the user that they can understand.