Skip to content

Commit

Permalink
@pcrespov review: renamed method
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderegg committed Jan 10, 2022
1 parent 6b89320 commit 35527c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/service-library/src/servicelib/aiohttp/monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from prometheus_client.registry import CollectorRegistry
from servicelib.aiohttp.typing_extension import Handler

from ..logging_utils import catch_log_exceptions
from ..logging_utils import log_catch

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -156,7 +156,7 @@ async def middleware_handler(request: web.Request, handler: Handler):
try:
log.debug("ENTERING monitoring middleware for %s", f"{request=}")
if enter_middleware_cb:
with catch_log_exceptions(logger=log, reraise=False):
with log_catch(logger=log, reraise=False):
await enter_middleware_cb(request)

in_flight_gauge = request.app[kINFLIGHTREQUESTS]
Expand Down Expand Up @@ -209,7 +209,7 @@ async def middleware_handler(request: web.Request, handler: Handler):
).inc()

if exit_middleware_cb:
with catch_log_exceptions(logger=log, reraise=False):
with log_catch(logger=log, reraise=False):
await exit_middleware_cb(request, resp)

if log_exception:
Expand Down
2 changes: 1 addition & 1 deletion packages/service-library/src/servicelib/logging_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def log_decorator_wrapper(*args, **kwargs):


@contextmanager
def catch_log_exceptions(logger: logging.Logger, reraise: bool = True):
def log_catch(logger: logging.Logger, reraise: bool = True):
try:
yield
except asyncio.CancelledError:
Expand Down

0 comments on commit 35527c6

Please sign in to comment.