From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 02FA79C0EE for ; Mon, 23 Oct 2023 13:43:55 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id D87B41333B for ; Mon, 23 Oct 2023 13:43:54 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 23 Oct 2023 13:43:53 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 9BB5644433 for ; Mon, 23 Oct 2023 13:43:53 +0200 (CEST) Message-ID: <9b4cb152-9c2b-41f0-b29a-8c47813f0518@proxmox.com> Date: Mon, 23 Oct 2023 13:43:52 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Dominik Csapak , Proxmox Backup Server development discussion Cc: Thomas Lamprecht , =?UTF-8?Q?Fabian_Gr=C3=BCnbichler?= References: <20231011140102.273423-1-g.goller@proxmox.com> <4e0de017-9fbf-4a5e-b735-62b955fe8a8b@proxmox.com> <0fd77836-896a-4017-9300-b74be824f346@proxmox.com> <030d3735-02c2-4a6e-860f-e8b6521e7e0e@proxmox.com> From: Gabriel Goller In-Reply-To: <030d3735-02c2-4a6e-860f-e8b6521e7e0e@proxmox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.297 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 SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pbs-devel] [RFC proxmox-backup 0/2] Tasklog rewrite with tracing X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2023 11:43:55 -0000 On 10/23/23 11:29, Dominik Csapak wrote: > [..] > having the 'tasklog' everytime make it harder to use imho, but if it's > hidden behind some macro > can be ok. > > in general what i'd like to have are three variants of logging: > > * task log only > * syslog only > * task log and syslog > > while the first and second will get the most use inside and outside a > worker context respectively > so that should be most convenient to use (iow. short) > > the second and third should also be possible in a worker context, but > there it's not so important > that it's short > > in my (naive) imagination i would have liked something like this: > > info!("foo"); // logs to task log inside worker, syslog outside > info!(syslog = true, "foo"); // logs only to syslog, even in worker > context > info!(syslog = true, tasklog = true, "foo"); // log in both task and > syslog (if possible) > > (the names are just placeholders, not suggestions. also i'm not > against using > macros for either like you wrote: task_log!, syslog!, task_and_syslog! > (probably not that)) > > does that make sense? (@Thomas, @Fabian?) > I like this, should be possible to implement as well. Although, if we are using macros (to get a cleaner/shorter version) we could just keep it simple and use the full version without inferring the write location using context. So: These **always** go to syslog:  - info!("..")  - error!("..")  - log::info!("..")  - ... Implement a macro task_log!(), task_warn!(), etc... that **always** goes to task_log: e.g.: #[macro_export] macro_rules! task_log {     ($task:expr, $($fmt:tt)+) => {{         info!(tasklog = true, &format_args!($($fmt)+))     }}; } But I'm open to other opinions and the input from @Thomas or @Fabian.