Python for Absolute Beginners Transcripts
Chapter: Reading and writing files in Python
Lecture: For real logging use a real framework

Login or purchase this course to watch this video and the rest of the course contents.
0:00 I want to just emphasize, do not do this
0:02 for actual logging, use a loggin framework.
0:06 So, I showed you that example before
0:08 about our file syncing things across
0:10 the different video servers
0:11 it's using this thing called Logbook.
0:13 And Logbook is super cool
0:14 what you do is you create an instance of it
0:16 and then you say
0:18 or log.notice, or log.error
0:20 and then you can set it at a level
0:22 so I only want to see warnings and errors
0:24 or I want to see notice, warnings, and errors
0:26 or I want to see everything.
0:27 Show me all the messages depending on what you're doing
0:29 with your application.
0:30 And it automatically adds the time
0:32 it automatically rotates the file name for the date
0:35 so you know it has, like if you said rps.log
0:38 it would be RPS log dash whatever the year, month, day is.
0:43 It's actually really handy cause these files
0:44 can get really out of control
0:46 and you usually want to know
0:47 kind of on this day or that day, what happened.
0:49 It also puts the messages about the level of the message
0:52 and the origin of the message.
0:53 This is way better, way more tested than something
0:56 that you're going to create.
0:57 And remember the login was more to teach you
0:59 about writing and appending the text files
1:01 than it was to actually create a login system.
1:03 So use a real one if you're actually going to do that
1:06 but this ideas you learn from the login example
1:09 are absolutely applicable to all sorts of files
1:12 that you might work with.