Skip to content

Commit 281a5b3

Browse files
committed
Remove cheat sheet.
The information wasn't presented in a useful format and some of it was out of date. Refs #1209.
1 parent 930defe commit 281a5b3

File tree

5 files changed

+38
-93
lines changed

5 files changed

+38
-93
lines changed

docs/faq/common.rst

+30-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,33 @@ Both sides
33

44
.. currentmodule:: websockets.asyncio.connection
55

6+
.. _enable-debug-logs:
7+
8+
How do I enable debug logs?
9+
---------------------------
10+
11+
You can enable debug logs to see exactly what websockets is doing.
12+
13+
If logging isn't configured in your application::
14+
15+
import logging
16+
17+
logging.basicConfig(
18+
format="%(asctime)s %(message)s",
19+
level=logging.DEBUG,
20+
)
21+
22+
If logging is already configured::
23+
24+
import logging
25+
26+
logger = logging.getLogger("websockets")
27+
logger.setLevel(logging.DEBUG)
28+
logger.addHandler(logging.StreamHandler())
29+
30+
Refer to the :doc:`logging documentation <../topics/logging>` for more details
31+
on logging in websockets.
32+
633
What does ``ConnectionClosedError: no close frame received or sent`` mean?
734
--------------------------------------------------------------------------
835

@@ -39,8 +66,9 @@ There are several reasons why long-lived connections may be lost:
3966
connections may terminate connections after a short amount of time, usually
4067
30 seconds, despite websockets' keepalive mechanism.
4168

42-
If you're facing a reproducible issue, :ref:`enable debug logs <debugging>` to
43-
see when and how connections are closed.
69+
If you're facing a reproducible issue, :ref:`enable debug logs
70+
<enable-debug-logs>` to see when and how connections are closed. connections are
71+
closed.
4472

4573
What does ``ConnectionClosedError: sent 1011 (internal error) keepalive ping timeout; no close frame received`` mean?
4674
---------------------------------------------------------------------------------------------------------------------

docs/faq/index.rst

+7-3
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@ Frequently asked questions
77
about :mod:`asyncio`.
88
:class: seealso
99

10-
Python's documentation about `developing with asyncio`_ is a good
11-
complement.
10+
If you're new to ``asyncio``, you will certainly encounter issues that are
11+
related to asynchronous programming in general rather than to websockets in
12+
particular.
1213

13-
.. _developing with asyncio: https://docs.python.org/3/library/asyncio-dev.html
14+
Fortunately, Python's official documentation provides advice to `develop
15+
with asyncio`_. Check it out: it's invaluable!
16+
17+
.. _develop with asyncio: https://docs.python.org/3/library/asyncio-dev.html
1418

1519
.. toctree::
1620

docs/howto/cheatsheet.rst

-86
This file was deleted.

docs/howto/index.rst

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ If you're stuck, perhaps you'll find the answer here.
2121
.. toctree::
2222
:titlesonly:
2323

24-
cheatsheet
2524
patterns
2625
autoreload
2726

docs/topics/logging.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Here's a basic configuration for a server in production::
7272
Here's how to enable debug logs for development::
7373

7474
logging.basicConfig(
75-
format="%(message)s",
75+
format="%(asctime)s %(message)s",
7676
level=logging.DEBUG,
7777
)
7878

0 commit comments

Comments
 (0)