[PATCH v2 0/2] Initial logging support for Rust

Bernhard Beschow posted 2 patches 5 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250610202110.2243-1-shentey@gmail.com
Maintainers: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
There is a newer version of this series
docs/devel/rust.rst              |  1 +
rust/wrapper.h                   |  2 +
rust/hw/char/pl011/src/device.rs | 12 +++--
rust/qemu-api/meson.build        |  1 +
rust/qemu-api/src/lib.rs         |  1 +
rust/qemu-api/src/log.rs         | 76 ++++++++++++++++++++++++++++++++
6 files changed, 89 insertions(+), 4 deletions(-)
create mode 100644 rust/qemu-api/src/log.rs
[PATCH v2 0/2] Initial logging support for Rust
Posted by Bernhard Beschow 5 months, 1 week ago
This series introduces a log_mask! macro which is inspired by the C version
and is just a thin wrapper around qemu_log(). It caters to Rust expectations by
accepting an enum for logging categories and working like the format! macro. The
macro then gets used in the pl011 device which either had its logging commented
out or relied on eprintln!() which can't be silenced by users.

Note that this is my first Rust contribution, so please check if the usage of
`unsafe` is sound.

v2:
* Drop the qemu_ prefix from the macro name (Paolo)
* Use an enum for the logging categories in PascalCase as suggested by Paolo

Bernhard Beschow (2):
  rust/qemu-api: Add initial logging support based on C API
  rust/hw/char/pl011/src/device: Implement logging

 docs/devel/rust.rst              |  1 +
 rust/wrapper.h                   |  2 +
 rust/hw/char/pl011/src/device.rs | 12 +++--
 rust/qemu-api/meson.build        |  1 +
 rust/qemu-api/src/lib.rs         |  1 +
 rust/qemu-api/src/log.rs         | 76 ++++++++++++++++++++++++++++++++
 6 files changed, 89 insertions(+), 4 deletions(-)
 create mode 100644 rust/qemu-api/src/log.rs

-- 
2.49.0