Wyatt Hepler | f9fb90f | 2020-09-30 18:59:33 -0700 | [diff] [blame] | 1 | .. _module-pw_assert_log: |
Keir Mierle | b776cb2 | 2020-08-14 16:46:50 -0700 | [diff] [blame] | 2 | |
| 3 | ============= |
| 4 | pw_assert_log |
| 5 | ============= |
| 6 | |
Ewout van Bekkum | 2b42268 | 2022-02-25 13:28:53 -0800 | [diff] [blame] | 7 | ----------------- |
| 8 | pw_assert_BACKEND |
| 9 | ----------------- |
| 10 | This assert backend implements the ``pw_assert:check`` facade, by routing the |
| 11 | ``PW_CHECK()``/``PW_CRASH()`` macros into ``PW_LOG`` with the |
| 12 | ``PW_LOG_LEVEL_FATAL`` log level. This is an easy way to tokenize your assert |
| 13 | messages, by using the ``pw_log_tokenized`` log backend for logging, then using |
| 14 | ``pw_assert_log`` to route the tokenized messages into the tokenized log |
| 15 | handler. |
Keir Mierle | b776cb2 | 2020-08-14 16:46:50 -0700 | [diff] [blame] | 16 | |
| 17 | To use this module: |
| 18 | |
| 19 | 1. Set your assert backend: ``pw_assert_BACKEND = dir_pw_assert_log`` |
| 20 | 2. Ensure your logging backend knows how to handle the assert failure flag |
Ewout van Bekkum | 2b42268 | 2022-02-25 13:28:53 -0800 | [diff] [blame] | 21 | |
| 22 | ---------------------- |
| 23 | pw_assert_LITE_BACKEND |
| 24 | ---------------------- |
| 25 | This assert backend implements the ``pw_assert:assert`` facade, by routing the |
| 26 | ``PW_ASSERT()`` macros into ``PW_LOG`` with the ``PW_LOG_LEVEL_FATAL`` log |
| 27 | level. This is an easy way to forward your asserts to a native macro assert |
| 28 | API if it is already constexpr safe such as on Android. |