Skip to content

Commit 4890607

Browse files
Added troubleshooting section to the documentation
1 parent 7365799 commit 4890607

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

docs/client.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,3 +299,26 @@ Or for ``asyncio``::
299299

300300
The single argument passed to the method is the number of seconds to sleep
301301
for.
302+
303+
Debugging and Troubleshooting
304+
-----------------------------
305+
306+
To help you debug issues, the client can be configured to output logs to the
307+
terminal::
308+
309+
import socketio
310+
311+
# standard Python
312+
sio = socketio.Client(logger=True, engineio_logger=True)
313+
314+
# asyncio
315+
sio = socketio.AsyncClient(logger=True, engineio_logger=True)
316+
317+
The ``logger`` argument controls logging related to the Socket.IO protocol,
318+
while ``engineio_logger`` controls logs that originate in the low-level
319+
Engine.IO transport. These arguments can be set to ``True`` to output logs to
320+
``stderr``, or to an object compatible with Python's ``logging`` package
321+
where the logs should be emitted to. A value of ``False`` disables logging.
322+
323+
Logging can help identify the cause of connection problems, unexpected
324+
disconnections and other issues.

docs/server.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,29 @@ example::
565565
# emit an event
566566
external_sio.emit('my event', data={'foo': 'bar'}, room='my room')
567567

568+
Debugging and Troubleshooting
569+
-----------------------------
570+
571+
To help you debug issues, the server can be configured to output logs to the
572+
terminal::
573+
574+
import socketio
575+
576+
# standard Python
577+
sio = socketio.Server(logger=True, engineio_logger=True)
578+
579+
# asyncio
580+
sio = socketio.AsyncServer(logger=True, engineio_logger=True)
581+
582+
The ``logger`` argument controls logging related to the Socket.IO protocol,
583+
while ``engineio_logger`` controls logs that originate in the low-level
584+
Engine.IO transport. These arguments can be set to ``True`` to output logs to
585+
``stderr``, or to an object compatible with Python's ``logging`` package
586+
where the logs should be emitted to. A value of ``False`` disables logging.
587+
588+
Logging can help identify the cause of connection problems, 400 responses,
589+
bad performance and other issues.
590+
568591
.. _deployment-strategies:
569592

570593
Deployment Strategies

0 commit comments

Comments
 (0)