[pbs-devel] [PATCH proxmox v3 3/3] proxmox-log: added tracing infra

Gabriel Goller g.goller at proxmox.com
Thu Apr 11 15:07:53 CEST 2024


On Thu Apr 11, 2024 at 2:08 PM CEST, Wolfgang Bumiller wrote:
> On Wed, Apr 10, 2024 at 04:17:17PM +0200, Gabriel Goller wrote:
> > diff --git a/proxmox-log/Cargo.toml b/proxmox-log/Cargo.toml
> > new file mode 100644
> > index 0000000..e05b0be
> > --- /dev/null
> > +++ b/proxmox-log/Cargo.toml
> > @@ -0,0 +1,23 @@
> > +[package]
> > +name = "proxmox-log"
> > +version = "0.1.0"
> > +authors.workspace = true
> > +edition.workspace = true
> > +license.workspace = true
> > +repository.workspace = true
> > +description = "Logging infrastructure for proxmox"
> > +
> > +exclude.workspace = true
> > +
> > +[dependencies]
> > +anyhow.workspace = true
> > +syslog.workspace = true
> > +nix.workspace = true
> > +log.workspace = true
> > +tracing.workspace = true
> > +tracing-subscriber.workspace = true
> > +tracing-log.workspace = true
>
> Technically we also need `features = [ "std" ]` here. Currently this is
> pulled in by `tracing-subscriber`
> ...
>

Setting it explicitly never hurt anybody :)

> > diff --git a/proxmox-log/debian/copyright b/proxmox-log/debian/copyright
> > new file mode 100644
> > index 0000000..0d9eab3
> > --- /dev/null
> > +++ b/proxmox-log/debian/copyright
> > @@ -0,0 +1,18 @@
> > +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
> > +
> > +Files:
> > + *
> > +Copyright: 2019 - 2023 Proxmox Server Solutions GmbH <support at proxmox.com>
>
> (2024)
>

Fixed.

> > diff --git a/proxmox-log/src/lib.rs b/proxmox-log/src/lib.rs
> > new file mode 100644
> > index 0000000..15fa22d
> > --- /dev/null
> > +++ b/proxmox-log/src/lib.rs
> > @@ -0,0 +1,34 @@
> > +use std::{cell::RefCell, env};
> > +use syslog_tasklog_layer::SyslogAndTasklogLayer;
> > +use tracing_log::{AsLog, LogTracer};
> > +use tracing_subscriber::filter::LevelFilter;
> > +use tracing_subscriber::prelude::*;
> > +
> > +mod file_logger;
> > +pub use file_logger::{FileLogOptions, FileLogger};
> > +
> > +mod syslog_tasklog_layer;
> > +
> > +tokio::task_local! {
> > +    pub static LOGGER: RefCell<FileLogger>;
> > +    pub static WARN_COUNTER: RefCell<u64>;
>
> `WARN_COUNTER` could just be a `Cell`.
>

Oooh, good catch!

Pulled in all your other suggestions as well.




More information about the pbs-devel mailing list