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,
0:02 so we did logging with logbook and monitoring with rollbar.
0:05 So if we wanted do logging here, we're going to create a logger
0:08 and we've already set up our stream handler, our time rotating file handler
0:13 the step that we had to do once at the start
0:17 and then we can say logbook.logger and give it a name
0:19 and this is sort of consistent way to do that create logger
0:22 so you don't have to continually remember its api/autos like this,
0:26 so put that in function and then throughout our api calls,
0:31 we can come down here and say for example an update auto
0:34 we can get the logger like this, do our work
0:36 and now if something fails, we could warn about this
0:38 say logger.warn, and give you information about what went wrong.
0:41 So in this accept block, we're going to say no, no, something went wrong here
0:45 then if the view model validation fails,
0:48 we can warn with details about those errors again,
0:51 and if everything works great, we can do a much lower level message
0:56 log.trace which only shows up maybe in development, but not production.