Skip to content

Initial logging support for Rust

Bernhard Beschow qemu-devel qemu-rust 3 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest4 patches 0 repliesNew
  2. v22 patches 12 repliesSuperseded
  3. v12 patches 15 repliesSuperseded

Changes in v3 from the cover letter

* Add macro to prelude (Manos)
* Have log_mask_ln! rather than log_mask! macro (Manos, Paolo)
* rustdoc improvements (Paolo)
* Fix logged function names (Manos)
* Add missing logging to pl011 to match C version (Paolo)
* Add patch to make clippy happier (which still complains about "PrimeCell" in rustdoc comment)

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4rust/qemu-api: Add initial logging support based on C APIdocs/devel/rust.rst rust/qemu-api/meson.build rust/qemu-api/src/lib.rs +3 more+85 -00 replies
2/4rust/hw/char/pl011/src/device: Implement loggingrust/hw/char/pl011/src/device.rs+8 -40 replies
3/4rust/hw/char/pl011/src/device: Add missing logging to match C versionrust/hw/char/pl011/src/device.rs+6 -00 replies
4/4rust/qemu-api: Fix clippy lint `missing_const_for_fn`rust/qemu-api/src/cell.rs rust/qemu-api/src/qom.rs+2 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/4] Initial logging support for Rust

This series introduces a log_mask_ln! 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.

Testing done:
* Run make clippy
* Purposefully trigger warnings with varying number of arguments

v3:
* Add macro to prelude (Manos)
* Have log_mask_ln! rather than log_mask! macro (Manos, Paolo)
* rustdoc improvements (Paolo)
* Fix logged function names (Manos)
* Add missing logging to pl011 to match C version (Paolo)
* Add patch to make clippy happier (which still complains about "PrimeCell" in rustdoc comment)

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 (4):
rust/qemu-api: Add initial logging support based on C API rust/hw/char/pl011/src/device: Implement logging rust/hw/char/pl011/src/device: Add missing logging to match C version rust/qemu-api: Fix clippy lint missing_const_for_fn

 docs/devel/rust.rst              |  1 +
 rust/wrapper.h                   |  2 +
 rust/hw/char/pl011/src/device.rs | 18 ++++++--
 rust/qemu-api/meson.build        |  1 +
 rust/qemu-api/src/cell.rs        |  2 +-
 rust/qemu-api/src/lib.rs         |  1 +
 rust/qemu-api/src/log.rs         | 78 ++++++++++++++++++++++++++++++++
 rust/qemu-api/src/prelude.rs     |  2 +
 rust/qemu-api/src/qom.rs         |  2 +-
 9 files changed, 101 insertions(+), 6 deletions(-)
 create mode 100644 rust/qemu-api/src/log.rs
Signature · 1 line
2.49.0