Skip to content

Commit

Permalink
Merge pull request #20 from havardthom/patch-1
Browse files Browse the repository at this point in the history
Use module-level logger, remove uvicorn logger
  • Loading branch information
sysid committed Aug 26, 2021
2 parents c6a3660 + 8c33483 commit 33fab69
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions sse_starlette/sse.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from starlette.responses import Response
from starlette.types import Receive, Scope, Send

_log = logging.getLogger(__name__)

# https://stackoverflow.com/questions/58133694/graceful-shutdown-of-uvicorn-starlette-app-with-websockets
class AppStatus:
Expand All @@ -27,7 +28,6 @@ def handle_exit(*args, **kwargs):


try:
from uvicorn.config import logger as _log # TODO: remove
from uvicorn.main import Server

original_handler = Server.handle_exit
Expand All @@ -39,11 +39,8 @@ def unpatch_uvicorn_signal_handler():
"""
Server.handle_exit = original_handler


except ModuleNotFoundError as e:
_log = logging.getLogger(__name__)
# logging.basicConfig(level=logging.INFO)
_log.debug(f"Uvicorn not used, falling back to python standard logging.")
_log.debug(f"Uvicorn not used")


class SseState(enum.Enum):
Expand Down

0 comments on commit 33fab69

Please sign in to comment.