Skip to content

Commit

Permalink
add debugging information
Browse files Browse the repository at this point in the history
  • Loading branch information
baseplate-admin committed May 9, 2024
1 parent 1e9c9bf commit f6ee3dd
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
37 changes: 37 additions & 0 deletions docs/debugging.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Debugging
=========

While `resvg-py`_ is a very thin wrapper around the `resvg`_ project there might be bugs in *resvg-py* (or *resvg*).

In order to debug the issue you have to enable logging in `resvg-py`_

How to log in `resvg-py`_?

When you call `resvg-py`_'s function in your code you can pass `log_information=True` to print debug information to the stdout

For example:

.. code-block:: python
import resvg_py
import base64
svg_string = """
<svg width="300" height="130" xmlns="http://www.w3.org/2000/svg">
  <rect width="200" height="100" x="10" y="10" rx="20" ry="20" fill="blue" />
</svg>
"""
# a large list of bytes
png_bytes: list[bytes] = resvg_py.svg_to_bytes(
svg_string=svg_string,
log_information = True ## <----------- CHECK THIS LINE
)
base64_utf8_str = base64.b64encode(bytes(png_bytes)).decode("utf-8")
print(f"data:image/png;base64,{base64_utf8_str}")
.. _resvg-py: https://github.com/baseplate-admin/resvg-py
.. _resvg: https://docs.rs/resvg/latest/resvg/
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Safe bindings for `resvg <https://github.com/RazrFalcon/resvg>`_
installation
usage
resvg
debugging
contributing

Indices and tables
Expand Down
2 changes: 1 addition & 1 deletion docs/resvg.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ Resvg Module

.. autofunction:: svg_to_bytes

.. autofuncton:: version
.. autofunction:: version

0 comments on commit f6ee3dd

Please sign in to comment.