On 18.02.2025 16:05, Wolfgang Bumiller wrote:
On Tue, Feb 18, 2025 at 03:52:26PM +0100, Gabriel Goller wrote:diff --git a/proxmox-log/src/lib.rs b/proxmox-log/src/lib.rs index 8c74e42b618d..755d1b4a850c 100644 --- a/proxmox-log/src/lib.rs +++ b/proxmox-log/src/lib.rs @@ -191,3 +191,20 @@ pub fn init_cli_logger( LogTracer::init_with_filter(log_level.as_log())?; Ok(()) } + +/// Write manually to the current tasklog bypassing the whole tracing infrastructure. Note that this +/// will also bypass all the filtering and writing to journald or elsewhere. If has_failed is true, +/// print to stderr as well. +pub fn log_manually_to_tasklog(msg: &str, has_failed: bool) -> Result<(), anyhow::Error> {What's "manual" about using a provided helper function? :-P
I thought of "manual" = "without tracing".
Besides, the name kind of conflicts with the stderr write, which seems even more specific to the rest-server case.
True.
Maybe a `LogContext::log_unfiltered(&str)` and rest-server just calls this+eprintln!()? Then the `error!()` invocation could be in a `None` match arm on the `LogContext::current()` match which IMO makes for much nicer control flow.
Damn, that's neat!
Do we even anticipate any other use case than the one in rest-server?
Nope, not really, just this one. Will submit a new patch with the changes soon! _______________________________________________ pve-devel mailing list [email protected] https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
