-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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 exc_info to access_logger #3557
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3557 +/- ##
==========================================
+ Coverage 97.87% 97.94% +0.07%
==========================================
Files 43 43
Lines 8561 8576 +15
Branches 1374 1374
==========================================
+ Hits 8379 8400 +21
+ Misses 77 74 -3
+ Partials 105 102 -3
Continue to review full report at Codecov.
|
@samuelcolvin would you fix mypy check? |
of course, I just wanted to check you think this is a good idea before I do more work on it? |
Honestly, I don't know. |
It's not cleared explicitly, but I tried The option is to add |
Do you propose to add Addition |
Ok, I'll try that. |
Ok, all changed, but I'm not sure why tests are failing, seems to be something to do with cython. |
@asvetlov I think this is basically done. However I have another question/feature request: How would you feel about I know this is currently possible with This could be done in a backwards compatible way by adding a |
@samuelcolvin would you fix merge conflicts? |
will do |
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don"t seem to have the users @samuelcolvin on file. In order for us to review and merge your code, please contact the project maintainers to get yourself added. |
Hopefully conflicts are fixed. How do I sign the contributor agreement? |
Just ignore CLA for now. |
ok no problem, passing except for CLA. |
aiohttp/web_protocol.py
Outdated
@@ -342,9 +342,11 @@ def force_close(self) -> None: | |||
def log_access(self, | |||
request: BaseRequest, | |||
response: StreamResponse, | |||
time: float) -> None: | |||
request_start: Optional[float]) -> None: |
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.
Looks like reverting back request_start
to strict float simplifies a code.
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.
lgtm
@asvetlov did you see this question? |
Async log method makes sense maybe. I have no objections and have no strong +1 feeling. BTW do you inherit your logger from |
The tests failure is not related to PR but a result of #3520 |
|
After thinking about the idea of
What do you think? |
Agreed, I think 3 will be the easiest appraoch. Will do in another PR |
Bump to rebuild CI |
I thought that my proposal has all three bullets necessary, not only the last one :) |
Let's merge the PR on green |
Done! |
:slowpoke:,but 👍 for async log. This will help a lot in future. |
working on it in #3767 |
What do these changes do?
Addexc_info
argument toAccessLogger.log
.call
AccessLogger.log
with the current exception available fromsys.exc_info()
.I'm trying to implement a custom
AccessLogger
to both print useful information to the terminal during development and log information about failed requests to sentry or equivalent in production.The problem is that
aiohttp.server
log methods are only called on an exception and without the request and response objects, whileAccessLogger.log
is called on every request but without any information about the exception.Currently, to achieve what I want I would have to either
AccessLogger
completely and modifying the app. This is particularly problematic inaiohttp-devtools
which is one of the places I want to use this.Are there changes in behavior for the user?
Only if they've implemented a custom
AccessLogger
Checklist
CHANGES
folder<issue_id>.<type>
for example (588.bugfix)issue_id
change it to the pr id after creating the pr.feature
: Signifying a new feature..bugfix
: Signifying a bug fix..doc
: Signifying a documentation improvement..removal
: Signifying a deprecation or removal of public API..misc
: A ticket has been closed, but it is not of interest to users.