#100DaysOfCode in Python Transcripts
Chapter: Days 31-33: Logging
Lecture: Your turn: Day 3

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Alright, final day, Day 3, of this block.
0:03 You're going to use logbook, and you're going to
0:05 add logging to your application.
0:07 Now this is an external requirement,
0:09 so I recommend you have a virtual environment
0:11 dedicated to this application.
0:13 Once you have it and you've activated it,
0:14 you'll pip install logbook to get started right here.
0:18 And then, you're going to need
0:20 to do a one time register of the logging,
0:23 and then you'll be able to use it over and over.
0:25 So here's the basic steps of how we did it in ours.
0:28 You could choose other handlers
0:30 and do other interesting things.
0:32 The StreamHandler and timed, rotating FileHandler,
0:35 those are the two that I like, but pick whatever you want.
0:40 And then once you're ready to log something,
0:42 you can create this sort of once.
0:44 You can create as many times as you want, but also can be
0:45 just queried the NAT level in the application.
0:48 And then you're going to use it and, say, "log.notice.
0:51 log.warn, log.critical" and so on.
0:54 So, take that little bit of information there,
0:56 and what you planned on logging and tracking
0:59 the day before, combine them, and make your app
1:01 production ready with logging.
1:04 I hope you enjoyed learning about Logbook and logging.
1:07 Be sure to share what you did with us
1:09 on Twitter, and hashtag it appropriately.
1:12 And that's it, you now have this new skill.
1:14 You can do really cool logging in your application.
1:17 And it's one of those things that pays off in the end.