Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Zsailer committed May 19, 2022
1 parent 25e4bde commit 9c500f8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions jupyter_server/services/events/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
AUTH_RESOURCE = "events"


class TornadoWebSocketLoggingHandler(logging.Handler):
class WebSocketLoggingHandler(logging.Handler):
"""Python logging handler that routes records to a Tornado websocket."""

def __init__(self, websocket):
super().__init__()
def __init__(self, websocket, *args, **kwargs):
super().__init__(*args, **kwargs)
self.websocket = websocket

def emit(self, record):
Expand Down Expand Up @@ -62,7 +62,7 @@ def open(self):
"""Routes events that are emitted by Jupyter Server's
EventBus to a WebSocket client in the browser.
"""
self.logging_handler = TornadoWebSocketLoggingHandler(self)
self.logging_handler = WebSocketLoggingHandler(self)
# Add a JSON formatter to the handler.
formatter = jsonlogger.JsonFormatter(json_serializer=_skip_message)
self.logging_handler.setFormatter(formatter)
Expand All @@ -72,6 +72,7 @@ def open(self):

def on_close(self):
self.event_bus.log.removeHandler(self.logging_handler)
self.event_bus.handlers.remove(self.logging_handler)


default_handlers = [
Expand Down

0 comments on commit 9c500f8

Please sign in to comment.