Re: [PATCH v2 1/2] rust/qemu-api: Add initial logging support based on C API

2025-06-12 Thread Paolo Bonzini
Il gio 12 giu 2025, 09:37 Bernhard Beschow ha scritto: > So the idea is to have a log_mask_ln! macro instead, since there isn't > really a point for a macro that doesn't add `\n` at the end. Correct? > Yes, or both. Paolo >

Re: [PATCH v2 1/2] rust/qemu-api: Add initial logging support based on C API

2025-06-12 Thread Bernhard Beschow
Am 11. Juni 2025 12:17:57 UTC schrieb Manos Pitsidianakis : >On Wed, Jun 11, 2025 at 2:05 PM Paolo Bonzini wrote: >> >> On Wed, Jun 11, 2025 at 12:57 PM Manos Pitsidianakis >> wrote: >> >> > Maybe we could take this chance to remove the requirement for trailing >> > newline? Not urgent, and a

Re: [PATCH v2 1/2] rust/qemu-api: Add initial logging support based on C API

2025-06-12 Thread Bernhard Beschow
Am 11. Juni 2025 12:17:57 UTC schrieb Manos Pitsidianakis : >On Wed, Jun 11, 2025 at 2:05 PM Paolo Bonzini wrote: >> >> On Wed, Jun 11, 2025 at 12:57 PM Manos Pitsidianakis >> wrote: >> >> > Maybe we could take this chance to remove the requirement for trailing >> > newline? Not urgent, and a

Re: [PATCH v2 1/2] rust/qemu-api: Add initial logging support based on C API

2025-06-11 Thread Manos Pitsidianakis
On Tue, Jun 10, 2025 at 11:21 PM Bernhard Beschow wrote: > > A log_mask!() macro is provided which expects similar arguments as the > C version. However, the formatting works as one would expect from Rust. > > To maximize code reuse the macro is just a thin wrapper around > qemu_log(). Also, just

Re: [PATCH v2 1/2] rust/qemu-api: Add initial logging support based on C API

2025-06-11 Thread Manos Pitsidianakis
On Wed, Jun 11, 2025 at 2:05 PM Paolo Bonzini wrote: > > On Wed, Jun 11, 2025 at 12:57 PM Manos Pitsidianakis > wrote: > > > Maybe we could take this chance to remove the requirement for trailing > > newline? Not urgent, and also something we could change afterwards > > anyway. We could also intr

Re: [PATCH v2 1/2] rust/qemu-api: Add initial logging support based on C API

2025-06-11 Thread Paolo Bonzini
On Wed, Jun 11, 2025 at 12:57 PM Manos Pitsidianakis wrote: > Maybe we could take this chance to remove the requirement for trailing > newline? Not urgent, and also something we could change afterwards > anyway. We could also introduce log_mask_ln! macro but now I'm just > bikeshedding. Good ide

Re: [PATCH v2 1/2] rust/qemu-api: Add initial logging support based on C API

2025-06-11 Thread Paolo Bonzini
Il mer 11 giu 2025, 12:21 Bernhard Beschow ha scritto: > Am 11. Juni 2025 07:56:23 UTC schrieb Paolo Bonzini : > >Clippy complains that it wants `` around the function name. > > Will fix in v3. > While at it, please run it through rustfmt and add a "//!" comment at the top, such as "Bindings for

Re: [PATCH v2 1/2] rust/qemu-api: Add initial logging support based on C API

2025-06-11 Thread Bernhard Beschow
Am 11. Juni 2025 07:56:23 UTC schrieb Paolo Bonzini : >On 6/10/25 22:21, Bernhard Beschow wrote: >> +/// A macro to log messages conditionally based on a provided mask. >> +/// >> +/// The `log_mask` macro checks whether the given mask matches the current >> log >> +/// level and, if so, format

Re: [PATCH v2 1/2] rust/qemu-api: Add initial logging support based on C API

2025-06-11 Thread Paolo Bonzini
On 6/10/25 22:21, Bernhard Beschow wrote: +/// A macro to log messages conditionally based on a provided mask. +/// +/// The `log_mask` macro checks whether the given mask matches the current log +/// level and, if so, formats and logs the message. It is the Rust counterpart +/// of the qemu_log_

[PATCH v2 1/2] rust/qemu-api: Add initial logging support based on C API

2025-06-10 Thread Bernhard Beschow
A log_mask!() macro is provided which expects similar arguments as the C version. However, the formatting works as one would expect from Rust. To maximize code reuse the macro is just a thin wrapper around qemu_log(). Also, just the bare minimum of logging masks is provided which should suffice fo