File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
packages/service-library/src/servicelib/fastapi Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ def setup_logging_lifespan(
2424 log_base_level : LogLevelInt ,
2525 noisy_loggers : tuple [str , ...] | None ,
2626) -> Lifespan :
27+ """Returns a FastAPI-compatible lifespan handler to set up async logging."""
2728 exit_stack = AsyncExitStack ()
2829 exit_stack .enter_context (
2930 setup_async_loggers_lifespan (
@@ -52,6 +53,13 @@ def setup_logging_shutdown_event(
5253 log_base_level : LogLevelInt ,
5354 noisy_loggers : tuple [str , ...] | None ,
5455) -> Callable [[], Awaitable [None ]]:
56+ """retruns a fastapi-compatible shutdown event handler to be used with old style lifespan
57+ handlers. This is useful for applications that do not use the new async lifespan
58+ handlers introduced in fastapi 0.100.0.
59+
60+ Note: This function is for backwards compatibility only and will be removed in the future.
61+ setup_logging_lifespan should be used instead for new style lifespan handlers.
62+ """
5563 exit_stack = AsyncExitStack ()
5664 exit_stack .enter_context (
5765 setup_async_loggers_lifespan (
You can’t perform that action at this time.
0 commit comments