-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Global request logging WIP #18
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kyranb I really appreciate this PR. Thanks a bunch.
Besides the comment in the review then I am not really sure I understand why you need two listeners? Is the $requestSendingEvent->request
the actual instance that is being sent, because if so then adding the middleware to that one should be just fine I quess?
*/ | ||
public function handle(ResponseReceived $event) | ||
{ | ||
$event->response->withMiddleware((new LoggingMiddleware( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Can we just use app(LoggingMiddleware::class)
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, I can't see why note. That would make sense to resolve it rather than instantiating it again
*/ | ||
public function handle(RequestSending $event) | ||
{ | ||
return $event->request->withMiddleware((new LoggingMiddleware( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Can we just use app(LoggingMiddleware::class)
instead?
ResponseReceived::class => [ | ||
LogResponseReceived::class, | ||
], | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we test this using a simple unit test that uses assertListening
? 🤔
Event::assertListening(
RequestSending::class,
LogRequestSending::class
);
Event::assertListening(
ResponseReceived::class,
LogRequestSending::class
);
See:
@kyranb Did you see me previous comment by any chance? 👍 |
@bilfeldt Sorry, yes I did but I haven't had a chance to dive back into this yet. I think you're correct, we only need to log the the sent request 👍 |
Hey Bilfeldt,
After your work on Footprints, I wanted to try and return the favour.
Description
This PR is a WIP. Haven't had the chance to test properly yet.
Does this close any currently open issues?
Aimes to fix #2
Type of change
Please delete options that are not relevant.
...
Checklist