blob: 7bdf8c5d2d7938334b492fcd7a868a5aee871509 [file] [log] [blame]
Wyatt Heplerf9fb90f2020-09-30 18:59:33 -07001.. _module-pw_log_basic:
Armando Montanez0054a9b2020-03-13 13:06:24 -07002
3------------
4pw_log_basic
5------------
Wyatt Hepler2ccde062020-09-16 21:58:53 -07006``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
Keir Mierleb1914022021-04-12 09:08:33 -070016.. cpp:function:: void SetOutput(void (*log_output)(std::string_view))
Wyatt Hepler2ccde062020-09-16 21:58:53 -070017
18 Set the log output function, which defaults ``pw_sys_io::WriteLine``. This
19 function is called with each formatted log message.
Armando Montanez0054a9b2020-03-13 13:06:24 -070020
21This module employs an internal buffer for formatting log strings, and currently
22has a fixed size of 150 bytes. Any final log statements that are larger than
23149 bytes (one byte used for a null terminator) will be truncated.
24
25.. note::
26 The documentation for this module is currently incomplete.