#100DaysOfCode in Python Transcripts
Chapter: Days 31-33: Logging
Lecture: Logging with Logbook
0:00 Python has built in log in
0:01 and you can do log in without
0:03 any external dependencies.
0:05 But I would like to introduce you to
0:07 this concept to this package logbook.
0:10 Now this as you can see here replaces
0:13 python's standard library for logging
0:16 and it does so in a way that makes it really easy
0:19 to work with logs in our application
0:21 but also super flexible.
0:23 So for example, we can come over here
0:25 and import the logger and we can just say
0:27 "I would just like to push all
0:28 the log messages to standard out",
0:30 could be a file also for example,
0:33 now we'll create a logbook
0:34 and then we just log.info,
0:38 we sort of categorize the response,
0:41 the message we'll send that way
0:42 and you get something like,
0:43 well see below but also what you see in stock python.
0:47 Why not just use the built in one?
0:49 Well, this is nice and clean and
0:50 it creates a nice hierarchy,
0:52 really really cool for when you use it your application.
0:54 But also it's way more flexible,
0:57 look at this,
0:58 how about getting a notification to your phone
1:00 or pushing notifications or something like that
1:02 under certain log message situations.
1:04 Really cool.
1:05 So we'll see the logbook is really powerful
1:09 and it's actually created by Armin Ronacher
1:11 who is the creator of Flask,
1:13 one of the most popular and well liked
1:16 Python web frameworks out there.