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 Log Messages

Sahar Nasiri
Sahar Nasiri
7,454 Points

What is different

logging.basicConfig(...., level = DEBUG) logging.debug() The file is saving on debug level why do we need to save a debug message?

1 Answer

Afrid Mondal
Afrid Mondal
6,255 Points

Hey Sahar, the logging functions are named after the level or severity of the events they are used to track. They are debug,info,warning..... So, among that DEBUG is used to find out the detailed information, typically of interest only when diagnosing problems.

Sahar Nasiri
Sahar Nasiri
7,454 Points

Hey Afrid, :) Thanks.

What would be different if I saved my file on another level? and how can I understand the level of a log text or a log file?

Afrid Mondal
Afrid Mondal
6,255 Points

Logging provides a set of convenience functions for simple logging usage. These are debug(), info(), warning(), error() and critical(). Always use Python Doc it is a really great place to grasp every details. https://docs.python.org/2/howto/logging.html