Commit ceb54146 authored by Philipp Hörist's avatar Philipp Hörist

Logging: Simplify passing context

parent 847e21a4
Pipeline #5204 failed with stages
in 27 seconds
......@@ -46,7 +46,7 @@ class SASL:
"""
Implements SASL authentication.
"""
def __init__(self, client, log_context):
def __init__(self, client):
self._client = client
self._password = None
......@@ -56,7 +56,7 @@ class SASL:
self._method = None
self._error = None
self._log = LogAdapter(log, {'context': log_context})
self._log = LogAdapter(log, {'context': client.log_context})
@property
def error(self):
......
......@@ -117,13 +117,13 @@ class Client(Observable):
self._ping_source_id = None
self._dispatcher = StanzaDispatcher(self, self._log_context)
self._dispatcher = StanzaDispatcher(self)
self._dispatcher.subscribe('before-dispatch', self._on_before_dispatch)
self._dispatcher.subscribe('parsing-error', self._on_parsing_error)
self._dispatcher.subscribe('stream-end', self._on_stream_end)
self._smacks = Smacks(self, self._log_context)
self._sasl = SASL(self, self._log_context)
self._smacks = Smacks(self)
self._sasl = SASL(self)
self._state = StreamState.DISCONNECTED
......
......@@ -101,14 +101,14 @@ class StanzaDispatcher(Observable):
"""
def __init__(self, client, log_context):
def __init__(self, client):
Observable.__init__(self, log)
self._client = client
self._modules = {}
self._parser = None
self._websocket_stream_error = None
self._log = LogAdapter(log, {'context': log_context})
self._log = LogAdapter(log, {'context': client.log_context})
self._handlers = {}
......
......@@ -37,7 +37,7 @@ class Smacks:
number of handled stanzas
"""
def __init__(self, client, log_context):
def __init__(self, client):
self._client = client
self._out_h = 0 # Outgoing stanzas handled
self._in_h = 0 # Incoming stanzas handled
......@@ -59,7 +59,7 @@ class Smacks:
self._session_id = None
self._location = None
self._log = LogAdapter(log, {'context': log_context})
self._log = LogAdapter(log, {'context': client.log_context})
self.register_handlers()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment