Skip to content
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

Add global logging #2

Open
bilfeldt opened this issue Feb 22, 2021 · 2 comments · May be fixed by #18
Open

Add global logging #2

bilfeldt opened this issue Feb 22, 2021 · 2 comments · May be fixed by #18
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@bilfeldt
Copy link
Owner

Add a configuration which would enable global logging of all requests made using the Laravel Http Client (if filter returns true of cause).

Note: This require the possibility to add global middleware to Illuminate\Http\Client\Factory - PR must be submitted

@bilfeldt bilfeldt added enhancement New feature or request help wanted Extra attention is needed labels Feb 22, 2021
@onlime
Copy link

onlime commented Jul 12, 2021

Hi @bilfeldt - Thanks for your great work. I have just published my own implementation of a global Laravel HTTP Client logger: onlime/laravel-http-client-global-logger. Our packages are quite different (see FAQ: How does this package differ from bilfeldt/laravel-http-client-logger?), so I didn't want to hold back my work.

I hope you get global logging as well working in your package. Maybe also use RequestSending / ResponseReceived event listeners? Don't know if that's the smartest way.

@bilfeldt
Copy link
Owner Author

Dear @onlime

Thanks for pointing my direction to this newly introduced event ResponseReceived which was apparently introduced in Laravel v8.49.2 and clearely solves this issue as this event has access to both the request and the response.

This is just a matter of simply implementing it now 😄 I would happily accept a PR for this if you are up for that, but of cause you are welcome to publish an alternative package. Maybe consider mentioning that the two packages are not compatibile since they both register the log() method on the PendingRequest class (this uses macros while yours uses mixins).

@kyranb kyranb linked a pull request Apr 20, 2022 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants