RESTful and HTTP APIs in Pyramid Transcripts
Chapter: Conclusion
Lecture: Lightning review: Logging and monitoring

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Next, logging and monitoring, so we did logging with logbook and monitoring with rollbar.
0:06 So if we wanted do logging here, we're going to create a logger and we've already set up our stream handler, our time rotating file handler
0:14 the step that we had to do once at the start and then we can say logbook.logger and give it a name
0:20 and this is sort of consistent way to do that create logger so you don't have to continually remember its api/autos like this,
0:27 so put that in function and then throughout our api calls, we can come down here and say for example an update auto
0:35 we can get the logger like this, do our work and now if something fails, we could warn about this
0:39 say logger.warn, and give you information about what went wrong. So in this accept block, we're going to say no, no, something went wrong here
0:46 then if the view model validation fails, we can warn with details about those errors again,
0:52 and if everything works great, we can do a much lower level message log.trace which only shows up maybe in development, but not production.

Talk Python's Mastodon Michael Kennedy's Mastodon