File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 11from typing import Any , Callable , List
22import logging
33
4+ log = logging .getLogger (__name__ )
5+
46class Disposables :
57 """A utility class to manage cleanup actions (disposables) in a LIFO order.
68
@@ -44,5 +46,5 @@ def cleanup(self) -> None:
4446 for action in reversed (self ._actions ):
4547 try :
4648 action ()
47- except BaseException as e :
48- logging . warning ( f"Cleanup action failed: { e } " )
49+ except BaseException :
50+ log . exception ( "cleanup action failed" )
Original file line number Diff line number Diff line change @@ -43,10 +43,10 @@ async def _update_environment(self):
4343 for listener in list (self ._listeners ):
4444 try :
4545 listener (env )
46- except Exception as e :
47- log .error ( f"Error in environment listener: { e } " )
48- except BaseException as e :
49- log .error ( f"Error in environment update: { e } " )
46+ except Exception :
47+ log .exception ( "failed to call listener" )
48+ except BaseException :
49+ log .exception ( "failed to update environment " )
5050
5151 async def _start_update_loop (self ):
5252 """Background coroutine that maintains the event stream"""
@@ -86,8 +86,8 @@ async def _start_update_loop(self):
8686 except BaseException as e :
8787 if self ._should_stop or isinstance (e , asyncio .CancelledError ):
8888 break
89-
90- log .warning ( f"Error in event stream, retrying in { retry_delay } s: { e } " )
89+
90+ log .exception ( "error in event stream, retrying in %s seconds" , retry_delay )
9191 await asyncio .sleep (retry_delay )
9292 retry_delay = min (retry_delay * 2 , max_delay )
9393
You can’t perform that action at this time.
0 commit comments