Issue30522
Created on 2017-05-31 08:09 by pitrou, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 2921 | closed | vinay.sajip, 2017-07-27 18:52 | |
| Messages (6) | |||
|---|---|---|---|
| msg294820 - (view) | Author: Antoine Pitrou (pitrou) * | Date: 2017-05-31 08:09 | |
Right now it is probably possible using something like:
handler.acquire()
try:
handler.flush()
handler.stream = new_stream
finally:
handler.release()
but it would be nice to have an officially-supported method to do that.
Context: if I reconfigure sys.stderr, I'd like to update all handlers that have a reference to the old sys.stderr.
|
|||
| msg294821 - (view) | Author: STINNER Victor (vstinner) * | Date: 2017-05-31 08:10 | |
Which StreamHandler class? Is this issue related to logging? If yes, please mention it in the title ;-) |
|||
| msg294822 - (view) | Author: Antoine Pitrou (pitrou) * | Date: 2017-05-31 08:10 | |
Oh, yes, sorry. This is about logging. |
|||
| msg297957 - (view) | Author: Vinay Sajip (vinay.sajip) * | Date: 2017-07-08 14:45 | |
How about this as an API?
def setStream(self, stream):
"""
Sets the StreamHandler's stream to the specified value,
if it is different.
Returns the old stream, if the stream was changed, or None
if it wasn't.
"""
|
|||
| msg297958 - (view) | Author: Antoine Pitrou (pitrou) * | Date: 2017-07-08 15:20 | |
Vinay, yes, that sounds fine to me. |
|||
| msg299495 - (view) | Author: Vinay Sajip (vinay.sajip) * | Date: 2017-07-30 09:41 | |
New changeset 2543f50033208c1a8df04999082b11aa09e82a04 by Vinay Sajip in branch 'master': bpo-30522: Implemented a method to allow setting a logging.StreamHander's stream. (GH-2921) https://github.com/python/cpython/commit/2543f50033208c1a8df04999082b11aa09e82a04 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:47 | admin | set | github: 74707 |
| 2017-07-30 09:44:33 | vinay.sajip | set | status: open -> closed resolution: fixed stage: resolved |
| 2017-07-30 09:41:48 | vinay.sajip | set | messages: + msg299495 |
| 2017-07-27 18:52:48 | vinay.sajip | set | pull_requests: + pull_request2975 |
| 2017-07-08 15:20:50 | pitrou | set | messages: + msg297958 |
| 2017-07-08 14:45:12 | vinay.sajip | set | messages: + msg297957 |
| 2017-05-31 08:10:30 | pitrou | set | messages:
+ msg294822 title: Allow replacing a StreamHandler's stream -> Allow replacing a logging.StreamHandler's stream |
| 2017-05-31 08:10:05 | vstinner | set | nosy:
+ vstinner messages: + msg294821 |
| 2017-05-31 08:09:10 | pitrou | create | |