Skip to content

Commit

Permalink
Add section about debug logging to the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
taras committed Oct 10, 2024
1 parent 174a8fe commit b0dffb2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Use pip to install it::
Documentation
=============

https://picows.readthedocs.io/en/stable/
https://picows.readthedocs.io/en/latest/

Motivation
==========
Expand Down Expand Up @@ -152,7 +152,7 @@ Features
* Provide Cython .pxd for efficient integration of user Cythonized code with picows
* Ability to check if a frame is the last one in the receiving buffer
* Auto ping-pong with an option to customize ping/pong messages.
* Convenient method to measure websocket roundtrip trip time using ping/pong messages.
* Convenient method to measure websocket roundtrip time using ping/pong messages.

Contributing / Building From Source
===================================
Expand Down
14 changes: 14 additions & 0 deletions docs/source/guides.rst
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,17 @@ If you are using Cython in your project, you can access picows type definitions
and some extra functionality by importing `picows.pxd <https://raw.githubusercontent.com/tarasko/picows/master/picows/picows.pxd>`_ that is installed with the library.

Check out an `example <https://raw.githubusercontent.com/tarasko/picows/master/examples/echo_client_cython.pyx>`_ of a simple echo client that is written in Cython.

Enable debug logs
-----------------

**picows** logs using Python's standard logging module under picows.* logger.
You may use any available way to set log level to PICOWS_DEBUG_LL (=9) to enable
debug logging.

.. code-block:: python
# Either set global log level
logging.basicConfig(level=picows.PICOWS_DEBUG_LL)
# Or set picows logger log level only
logging.basicConfig(level=logging.INFO)
logging.getLogger("picows").setLevel(picows.PICOWS_DEBUG_LL)
3 changes: 2 additions & 1 deletion examples/okx_roundtrip_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ async def main(url):


if __name__ == '__main__':
logging.basicConfig(level=9)
logging.basicConfig(level=logging.INFO)
logging.getLogger("picows").setLevel(9)
asyncio.run(main("wss://ws.okx.com:8443/ws/v5/public"))

0 comments on commit b0dffb2

Please sign in to comment.