Adding a CMS to Your Flask Web App Transcripts
Chapter: Logging activity
Lecture: Setting markdown log levels
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Let's talk about how much information is coming on these logging systems. We look at two things, actually,
0:06
the overall website, with its logbook integration in markdown sub template In general, let's actually look at the overall one first.
0:14
So over here you can see we're setting the level and there's some different options.
0:19
Weaken said it, too, consented to debug error notice critical and warning. Now, when we run it, let's leave. Run the bug for a second.
0:27
You'll see that there are some notices and some in foes coming out of it, ideas that we wanna show stuff that is this level of ah issue and higher.
0:36
So if we just set this to notice and run it, notice the lower importance info stuff is gone. We say we only want to see errors.
0:46
This informational stuff is gone, right? This comes out of flats. We can't control that, But all the other stuff we can hand,
0:54
it's no longer coming out. So when it's over, here we go. Look at one of these Did help with five ei notice that
1:01
we're getting this informational level thing. We can actually go and change this in the same manner as we are here, we can change it over here.
1:10
So let's go up and from markdown subject what we had pulled out storage. We can also get logging. Go back down to our mark down and here we
1:19
say, MD log. It's going to be this Get log empty dog dialogue level There's gonna be a logging dot log level.
1:30
Careful, there's this one which comes from our website, and there's this one which comes from that library.
1:36
They have the same name, but they're not the same. So just be sure to not cross those over that will be. I don't know what will happen.
1:42
Crossing the streams probably seen Ghostbusters. It's not good. All right, so let's say we only want to see error messages out of here now.
1:49
If we rerun this, we request this page a bunch of times. You'll see flash stuff that we can't ignore,
1:56
cause it's in the bug, but notice there's no messages. On the other hand, if we put this at Trace and we make a bunch
2:05
of requests, you'll see all sorts of output like here's generally the mark down here Drinking generated HTML. Here's using the cash and so on.
2:14
So this is quite simply how we set the log level. I'm gonna put this to info and this to info. Finally, once we mix these things together,
2:23
once we get the markdown sub template logging going through the logbook system,
2:27
what you'll find is that the thing that actually restricts or determines what messages get out
2:32
will be the more restrictive of these two for at least these messages, because it's only gonna get out of here if it passes this level.
2:40
And it's only gonna get finally out of logbook if it passes that level. So whichever one is more restrictive is the one that's gonna be in effect.
2:48
But here's a real simple way to control markdown subject logging. And if you just want to see nothing at all, you can just set it off.
2:55
Even if there's an error, it'll shut up and leave you alone. I think it was a good level well integrated with our logbook,
3:02
and that'll be great. But if you want to change it to turn it off or turn it up, feel free to do so.