From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9])
	by lore.proxmox.com (Postfix) with ESMTPS id 0F13F1FF168
	for <inbox@lore.proxmox.com>; Tue, 18 Feb 2025 17:36:39 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 0D8C51202B;
	Tue, 18 Feb 2025 17:36:34 +0100 (CET)
Date: Tue, 18 Feb 2025 17:36:31 +0100
From: Gabriel Goller <g.goller@proxmox.com>
To: Wolfgang Bumiller <w.bumiller@proxmox.com>
Message-ID: <ke6hn5rc5erqs6qsxkyo5m4zdcnzhhv3w3yua6rykvbtz5jumu@2iuu67hhkblu>
References: <20250218145226.380369-1-g.goller@proxmox.com>
 <kfzvtzhuf2uu3tlxekemgcqtwmrqk24kdzbkifnj2srr4lgzsw@dbuq6xjs3c5m>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <kfzvtzhuf2uu3tlxekemgcqtwmrqk24kdzbkifnj2srr4lgzsw@dbuq6xjs3c5m>
User-Agent: NeoMutt/20241002-35-39f9a6
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.030 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [lib.rs]
Subject: Re: [pve-devel] [PATCH proxmox v2] worker_task: write result
 message manually, bypassing tracing
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Cc: pve-devel@lists.proxmox.com
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

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
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel