Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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