public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Gabriel Goller <g.goller@proxmox.com>
To: Dominik Csapak <d.csapak@proxmox.com>,
	Proxmox Backup Server development discussion
	<pbs-devel@lists.proxmox.com>
Cc: "Thomas Lamprecht" <t.lamprecht@proxmox.com>,
	"Fabian Grünbichler" <f.gruenbichler@proxmox.com>
Subject: Re: [pbs-devel] [RFC proxmox-backup 0/2] Tasklog rewrite with tracing
Date: Mon, 23 Oct 2023 13:43:52 +0200	[thread overview]
Message-ID: <9b4cb152-9c2b-41f0-b29a-8c47813f0518@proxmox.com> (raw)
In-Reply-To: <030d3735-02c2-4a6e-860f-e8b6521e7e0e@proxmox.com>

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.




  reply	other threads:[~2023-10-23 11:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-11 14:01 Gabriel Goller
2023-10-11 14:01 ` [pbs-devel] [RFC proxmox-backup 1/2] log: removed task_log! macro and moved to tracing Gabriel Goller
2023-10-11 14:01 ` [pbs-devel] [RFC proxmox 2/2] proxmox-log: added tracing infra Gabriel Goller
2023-10-13 12:36   ` Gabriel Goller
2023-10-18 13:26   ` Dominik Csapak
2023-10-23  8:56     ` Gabriel Goller
2023-10-23  9:11       ` Gabriel Goller
2023-10-18 13:12 ` [pbs-devel] [RFC proxmox-backup 0/2] Tasklog rewrite with tracing Dominik Csapak
2023-10-23  9:09   ` Gabriel Goller
2023-10-23  9:29     ` Dominik Csapak
2023-10-23 11:43       ` Gabriel Goller [this message]
2023-10-23 14:33       ` Thomas Lamprecht
2023-10-24 13:44         ` Gabriel Goller
2023-10-25 13:55           ` Gabriel Goller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9b4cb152-9c2b-41f0-b29a-8c47813f0518@proxmox.com \
    --to=g.goller@proxmox.com \
    --cc=d.csapak@proxmox.com \
    --cc=f.gruenbichler@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    --cc=t.lamprecht@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal