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