Skip to content

Commit

Permalink
add debugging information (#31)
Browse files Browse the repository at this point in the history
* add

* Update test_font_render.py

* Update CI.yaml

* Update Cargo.toml

* add

* Update CI.yaml

* Update Cargo.toml

* Reduce more size?

* add debugging information
  • Loading branch information
baseplate-admin authored May 9, 2024
1 parent b143a1c commit c19cc0c
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 c19cc0c

Please sign in to comment.