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

Spencer Hurrle
Spencer Hurrle
3,128 Points

I'm progressing, but I don't understand the formatting

Challenge Task 1 of 2 asked about creating a DEBUG message, but I don't understand why we use all caps (logging.DEBUG) when passing it to basicConfig, but we use lowercase when debug is being passed a message. Are these the same methods or are they two different things in logging?

starter.py
import logging

logging.basicConfig(filename='cc.log', level=logging.DEBUG)

# Write your code below here
logging.debug("Message")
logging.warning("The French have the Grail")

1 Answer

Steven Parker
Steven Parker
231,268 Points

The Python language is case-sensitive, and those are different things. The name "debug()" (lower case) is a method, and "DEBUG" (upper case) is a constant value.