Crate pw_log_backend_printf

Source
Expand description

pw_log backend that calls libc’s printf to emit log messages. This module is useful when you have a mixed C/C++ and Rust code base and want a simple logging system that leverages an existing printf implementation.

Note: This uses FFI to call printf. This has two implications:

  1. C/C++ macro processing is not done. If a system’s printf relies on macros, this backend will likely need to be forked to make work.
  2. FFI calls use unsafe. Attempts are made to use printf in sound ways such as bounding the length of strings explicitly but this is still an off-ramp from Rust’s safety guarantees.

Varargs marshaling for call to printf is handled through a type expansion of a series of traits. It is documented in the varargs module.

TODO: <pwbug.dev/311232605> - Document how to configure facade backends.

Modules§

varargs
Infrastructure for building calls to printf.

Macros§

pw_log_backend
Implements the pw_log backend api.
pw_logf_backend
Implements the pw_log backend api.