Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
One of the first things programmers do when software starts misbehaving is to stick in `print()` calls. This is great if you don't mind extra output, but there's a better way to get diagnostic info back from your app!
The Python logging
library docs
New terms:
- level - The level that you want to start logging messages at. Any message at this level or above will be logged.
- Logging Levels:
- CRITICAL
- ERROR
- WARNING
- INFO
- DEBUG
- NOTSET
Example:
import logging
try:
[1, 2, 3].remove(4)
except ValueError:
logging.error("tried to remove an invalid value")
print("Sorry, that value doesn't exist.")
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Bryan Ziel
2,483 Points1 Answer
-
Harry Han
19,850 Points1 Answer
-
jayda hendrickson
3,413 Points1 Answer
-
Aizah Sadiq
2,435 Points1 Answer
-
Eldin Guzin
6,010 Points2 Answers
-
drew s
Python Development Techdegree Graduate 19,491 Points2 Answers
-
Anthony Grodowski
4,902 Points1 Answer
-
Anthony Grodowski
4,902 Points1 Answer
-
kdawg
4,655 Points1 Answer
-
Andrew McLane
3,385 Points1 Answer
-
Henry Lin
11,636 Points1 Answer
-
seong lee
4,503 PointsI don't understand. If someone helps me I would really appreciate it.
Posted by seong leeseong lee
4,503 Points5 Answers
-
Michal Janek
Front End Web Development Techdegree Graduate 30,654 Points1 Answer
-
Sahar Nasiri
7,454 Points1 Answer
-
MUZ140920 Kudakwashe Murungu
6,316 Points2 Answers
-
joleneoropilla
17,214 Points1 Answer
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up