php-http / logger-plugin

PSR-3 Logger plugin for HTTPlug
http://docs.php-http.org/en/latest/plugins/logger.html
MIT License
282 stars 7 forks source link

Adding time for the request #5

Closed Nyholm closed 6 years ago

Nyholm commented 6 years ago
Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Related tickets
Documentation if this is a new feature, link to pull request in https://github.com/php-http/documentation that adds relevant documentation
License MIT

What's in this PR?

We should log the time it takes to make a request

If we think this is something we want Im happy to complete this PR.

To Do

dbu commented 6 years ago

sounds valuable to me, lets do it!

Nyholm commented 6 years ago

I found this PR which I did not complete. Im not sure how I could make PHPSpec allow me to add a random integer like I did. I've searched the manual extensively but found nothing.

nicholasruunu commented 6 years ago

@Nyholm This is how you would handle it: https://github.com/nicholasruunu/logger-plugin/commit/b708f389998eac364bea74b254ef938dfa9403c5

But the "Received response" info calls are actually not being made when you call handleRequest().

Nyholm commented 6 years ago

Awesome Nicholas. Thank you. Will finish this PR tonight.

Nyholm commented 6 years ago

The test showed that my implementation was flawed. Thanks again for helping me.

I've used your commit and I've updated the PR. Im now ready for a review

joelwurtz commented 6 years ago

Nice one. i'm also wondering if we should use Stopwatch in the future if present, and puts this informations in the context ?

Nyholm commented 6 years ago

Thank you for the review. Hm.. Isn't that done already if you use the Symfony Bundle?

joelwurtz commented 6 years ago

It was more using Stopwatch implementation instead of microtime if available, but not really necessary