xref: /aosp_15_r20/external/pigweed/pw_log_basic/docs.rst (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1.. _module-pw_log_basic:
2
3------------
4pw_log_basic
5------------
6``pw_log_basic`` is a ``pw_log`` backend that sends logs over ``pw_sys_io`` by
7default. The destination of ``pw_sys_io`` depends on the ``pw_sys_io`` backend
8in use. This is controlled by the ``dir_pw_sys_io_backend`` variable in a
9target's ``target_config.gni``.
10
11The log output may be changed from ``pw_sys_io`` to an arbitrary function by
12calling ``pw::log_basic::SetOutput``.
13
14.. cpp:namespace:: pw::log_basic
15
16.. cpp:function:: void SetOutput(void (*log_output)(std::string_view))
17
18  Set the log output function, which defaults ``pw_sys_io::WriteLine``. This
19  function is called with each formatted log message.
20
21This module employs an internal buffer for formatting log strings, whose size
22can be configured via the ``PW_LOG_BASIC_ENTRY_SIZE`` macro which defaults to
23150 bytes. Any final log statements that are larger than
24``PW_LOG_BASIC_ENTRY_SIZE - 1`` bytes (one byte used for a null terminator) will
25be truncated.
26
27.. note::
28  The documentation for this module is currently incomplete.
29