-
Notifications
You must be signed in to change notification settings - Fork 1.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
12188 add logging handler context managers #12207
Conversation
CodSpeed Performance ReportMerging #12207 will not alter performanceComparing Summary
|
@twm fyi this is your fault for making me actually consider the design (Thank you, the code is much better for it, but still, there's like 1000 lines now) |
Sigh, trying one more force push to get rid of spurious codecov statuses that seem to have gotten stuck to the win32 stdio changes. |
docs/core/howto/logger.rst
Outdated
|
||
:py:class:`Logger <twisted.logger.Logger>` provides a :py:meth:`failure <twisted.logger.Logger.failure>` method, which allows one to capture a :py:class:`Failure <twisted.python.failure.Failure>` object conveniently: | ||
:py:class:`Logger <twisted.logger.Logger>` provides a :py:meth:`failure <twisted.logger.Logger.handlingFailures>` method, which allows one to run some application code, then capture a :py:class:`Failure <twisted.python.failure.Failure>` in the log stream if that code raises an exception: |
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.
Maybe we should also have an example demonstrating the usage of the "Operation" ... or at least a few words about the fact that the context manager returns an "operation" that can be used to check the result and contains a reference to the raised Failure
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.
Thanks for the update.
I did a quick review and left a few comments.
I haven't looked into the details of win32
and threadselect
changes
I think that this is a big improvement.
I have approved it, but I am leaving this for review for Tom or other team members.
If a further review is delayed, I think that this can be merged.
Thanks again!
Thanks @adiroiban, I really appreciate that! I think this is one that might benefit from some post-hoc review, so after reviewing and addressing your comments I might land pretty quickly, but will be interested in feedback from others later. |
The problem in this case is that the job did not fail, but that codecov reported annotations
I use it all the time :) In this particular case, the issue is that the job did not actually fail. Codecov ran, it emitted some annotations, failed the check, then withdrew the failure once the Windows coverage arrived, but didn't withdraw the annotations. You can see them on the current files changed tab like this: which of course makes no sense given that the patch is 100% covered and these are patch lines. I was hoping that the bug was intermittent and might be addressed by a full rebuild, but no, it looks like a flaw in codecov. |
huh, why did the robot not notice this and add |
It might be due to this
I think that as long as there are requested reviewers, it is not yet considered ready for merge. |
OK, I can remove twm then |
Oh… but that doesn't help, because… somehow you reviewed as you, and not "on behalf of twisted-contributors"? Hmmm. I guess I should just mention people and never use the review-request mechanism. |
Not going to wait for Docker to resolve their incident here, but if there's a problem we can revert. |
The review robot is not AI. The main use case for the robot is to allow non Twisted Org members to manage add the review label |
Yeah, I should contribute back to it a bit more :). But I really want in-org members to use it as much as possible, so we have a common workflow. |
You can start by submitting bug reports and defining the rules/requirements/specifications for the robot. I think that the robot works. For this PR, you have explicitly requested a review from Tom and Tom has not reviewed the PR yet. For example see #12213 The PR was started as draft. As soon as the PR was no longer a draft the review label was added and a review was requested for the whole team. I have reviewed the change and the PR was marked for merge. Another example is #12216 ... I have expliclty requested the review, the label was autoatically applied and the Twisted team was automatically added to review. As soon as someone from the team has reviewd and approved the PR, it was marked for merge. Another example is #12202 ... marked as no longer a draft, the review was automatically request, I have requested changes and the label was automatically updated. |
Twisted recently changed behavior of logger on failures [1]. It newly logs the `Main loop terminated.` even on exceptions, which breaks two test in twistedsupport test suite. This hack attempts to address the upcoming issue. [1] twisted/twisted#12207
Twisted recently changed behavior of logger on failures [1]. It newly logs the `Main loop terminated.` even on exceptions, which breaks two test in twistedsupport test suite. This hack attempts to address the upcoming issue. [1] twisted/twisted#12207
Twisted recently changed behavior of logger on failures [1]. It newly logs the `Main loop terminated.` even on exceptions, which breaks two test in twistedsupport test suite. This hack attempts to address the upcoming issue. [1] twisted/twisted#12207
This is a retread of #12196 with a simpler commit history. Its description: