در حال بارگذاری ...

Introducing Laravel PAIL0:01

This next package here on my list is actually from Laravel itself. Created by Nuno, but now it's maintained by Laravel, and it's also brand new. It's called Laravel PAIL. Here we are in the repository for Laravel PAIL. That's a nice icon here, which probably is by Kaneko, I don't know, just guessing. So let's see what this does. Laravel PAIL is a package that allows you to easily dive into your application log files directly from the command line. Unlike other log tailing packages, PAIL is designed to work with any log driver, including Sentry or fail.

Unlike other log tailing packages, PAIL is designed to work with any log driver, including Sentry or fail. So this sounds pretty big, because I believe this currently wasn't possible with any given tail packages that have already been out there. So tailing is like getting some data normally just from your given log files. But I believe this is working differently. Let's read more. In addition, PAIL focuses on developer experience. It provides a sleek client interface with user-friendly design and a set of views for filters to help you find what you are looking for.

It provides a sleek client interface with user-friendly design and a set of views for filters to help you find what you are looking for. So I already know when Nuno is working on something on the command line, it always looks just amazing. So as you can see, currently, when I'm looking at this, this is in beta. Maybe when you're watching this, this is already out. I don't know. But I believe it's almost feature ready. All right, let's copy this.

Installing and Running PAIL1:26

But I believe it's almost feature ready. All right, let's copy this. This is then how we're going to start it. Let's bring this package in. Here we go. And then we're going to start it with php artisan. Not PAIL, TAIL. Here we go. All right, so this is what the interface looks like for now. And let's see how we can bring in some data here.

Tailing Artisan Errors1:46

All right, so this is what the interface looks like for now. And let's see how we can bring in some data here. So we're going to start by running an artisan command that doesn't exist. So php artisan does not exist. All right, here in this new window, we can see that command does not exist. It's not defined. But if we go back to php, we can see, voila, here we have now a new entry. There was a command not found exception. Here we see where it came from. There was an artisan command, which we see right here.

Here we see where it came from. There was an artisan command, which we see right here. By the way, yeah, this part here with those lines around, this just looks amazing. I mean, come on. We are in the command line here, and this looks so good. I really love it. Some nice coloring here. And here we have the most interesting thing. The command does not exist.

Comparing Raw Log Files2:34

And here we have the most interesting thing. The command does not exist. It's not defined. So I already love this look here. Let's try something else. I got export post command where I'm just inferring something out. Oh, by the way, I think we should also take a look what it normally looks like in my logs file here. So normally this is what I have to deal with in my logs files, and yeah, come on.

So normally this is what I have to deal with in my logs files, and yeah, come on. How do you even find stuff here? Here we see some issues, then lots of line here, and then probably here, when there's a date, probably there's a new error. Yeah, this is definitely not what we love to work with. So back to our command. Here I'm inferring out some string here. So let's give this a try as well.

Here I'm inferring out some string here. So let's give this a try as well. php artisan export posts. All right, we don't see anything here, but in pale we now see we also got a new info. You can see it's now blue, so I have a different coloring here, which is nice, and it also tells you here which artisan command was used. So I believe this is just amazing. I mean, come on, how cool is this?

Viewing Web Exceptions3:43

So I believe this is just amazing. I mean, come on, how cool is this? And again, the look. I'm really in love with this package here. Okay, what else can we try? Let's try something on the front end. So I have here a controller, and let's just throw here a new Exception. And let's just say storing Post does not work. All right, and then on our form here,

And let's just say storing Post does not work. All right, and then on our form here, let's give this a try. Test, test, publish. We see that we get an exception here, but what does it look like on pale? Let's make this a little bigger, and yeah, voila. Here we see now a new exception, and we see again where this is coming from. So this comes from the CreatePostController.

and we see again where this is coming from. So this comes from the CreatePostController. So I mean, I believe from all the... Let's check again what we have in our log files. Let's go down here. Where is it? Yeah, it's this one here. Storing post does not work. And here, we also got here some information, but yeah, come on, there's so much stuff

And here, we also got here some information, but yeah, come on, there's so much stuff that I'm not interested in. And I'm just trying to find this. It's not really what I love to do. So going here, just seeing that the controller line 12 is what exception was from. This was the text. And here we also see now this was a POST request to this endpoint with this user and this email address.

And here we also see now this was a post request to this endpoint with this User and this email address. I mean, really, this is really something else. And yeah, I believe a lot of people are going to use this when it's out. Probably you're already using it. I can really understand you because this is really just amazing. Again, small package, install it, pill it up. Pill it up is now a new word, a new phrase that I just created. Pill it up, and you get all your exceptions and infos here. And then, yeah, you can work on.

Using Verbosity and Filters5:38

Pill it up, and you get all your exceptions and infos here. And then, yeah, you can work on. I just really believe this is an amazing package and perfect for our series. All right, let's see. So anything else we need to be aware of? There are some options here to get more output with more details. -v, --vv. I think filter is also interesting. If you get a lot of messages into payload

I think filter is also interesting. If you get a lot of messages into payload and you want just to filter for some specific ones, you can do this like this, which is a great way to just see what you are looking for. Let's break down what we just learned. Going through a log file, searching for exceptions or messages that you logged is quite painful, and it doesn't look very good. So I'm very happy that there is now Laravel Mail,

and it doesn't look very good. So I'm very happy that there is now Laravel Sail, which I use probably in all of my applications from now on, because it's so much easier with Sail to see what exceptions and logging messages there are. Thank you, Nuno and Laravel.

دوست دارید گاهی خبرهای Laracasts را ایمیل کنیم؟