[pbs-devel] [RFC proxmox-backup 0/2] Tasklog rewrite with tracing

Gabriel Goller g.goller at proxmox.com
Mon Oct 23 13:43:52 CEST 2023

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.
These **always** go to syslog:
  - info!("..")
  - error!("..")
  - log::info!("..")
  - ...

Implement a macro task_log!(), task_warn!(), etc... that **always** goes 
to task_log:
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.

More information about the pbs-devel mailing list