xref: /aosp_15_r20/external/pigweed/pw_assert/backends.rst (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1.. _module-pw_assert-backends:
2
3==================
4pw_assert backends
5==================
6.. pigweed-module-subpage::
7   :name: pw_assert
8
9.. TODO: b/323607687 - Add backend guidance here
10
11The following backends are already implemented and available for use in your
12projects:
13
14- ``pw_assert:print_and_abort_backend`` - **Stable** - Uses the ``printf`` and
15  ``abort`` standard library functions to implement the assert facade. Prints
16  the assert expression, evaluated arguments if any, file/line, function name,
17  and user message, then aborts. Only suitable for targets that support these
18  standard library functions.
19- :ref:`module-pw_assert_basic` - **Stable** - The assert basic module is a
20  simple assert handler that displays the failed assert line and the values of
21  captured arguments. Output is directed to ``pw_sys_io``. This module is a
22  great ready-to-roll module when bringing up a system, but is likely not the
23  best choice for production.
24- :ref:`module-pw_assert_log` - **Stable** - This assert backend redirects to
25  logging, but with a logging flag set that indicates an assert failure. This
26  is our advised approach to get **tokenized asserts**--by using tokenized
27  logging, then using the ``pw_assert_log`` backend.
28
29Note: If one desires a null assert module (where asserts are removed), use
30``pw_assert_log`` in combination with ``pw_log_null``. This will direct asserts
31to logs, then the logs are removed due to the null backend.
32
33.. toctree::
34   :maxdepth: 1
35
36   Basic <../pw_assert_basic/docs>
37   Pigweed logging <../pw_assert_log/docs>
38   Fuchsia <../pw_assert_fuchsia/docs>
39   Tokenized <../pw_assert_tokenized/docs>
40   Trap <../pw_assert_trap/docs>
41   Zephyr <../pw_assert_zephyr/docs>
42