#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. You're going to use logbook, and you're going to add logging to your application.
0:08 Now this is an external requirement, so I recommend you have a virtual environment dedicated to this application.
0:14 Once you have it and you've activated it, you'll pip install logbook to get started right here. And then, you're going to need
0:21 to do a one time register of the logging, and then you'll be able to use it over and over. So here's the basic steps of how we did it in ours.
0:29 You could choose other handlers and do other interesting things. The StreamHandler and timed, rotating FileHandler,
0:36 those are the two that I like, but pick whatever you want. And then once you're ready to log something, you can create this sort of once.
0:45 You can create as many times as you want, but also can be just queried the NAT level in the application.
0:49 And then you're going to use it and, say, "log.notice. log.warn, log.critical" and so on. So, take that little bit of information there,
0:57 and what you planned on logging and tracking the day before, combine them, and make your app production ready with logging.
1:05 I hope you enjoyed learning about Logbook and logging. Be sure to share what you did with us on Twitter, and hashtag it appropriately.
1:13 And that's it, you now have this new skill. You can do really cool logging in your application. And it's one of those things that pays off in the end.


Talk Python's Mastodon Michael Kennedy's Mastodon