public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH] log: only print error level to syslog/stderr
@ 2024-10-18 11:11 Gabriel Goller
  2024-10-18 17:03 ` [pbs-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 3+ messages in thread
From: Gabriel Goller @ 2024-10-18 11:11 UTC (permalink / raw)
  To: pbs-devel

We only want to print the error level, and not all the levels below
error to stderr/syslog.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---

Note: the sign was reversed "<=" would have been correct, because we
want to print everything that's *less* verbose than Level::ERROR, but
there is nothing lower than ERROR, so == is better.

 proxmox-log/src/lib.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxmox-log/src/lib.rs b/proxmox-log/src/lib.rs
index 332f66221477..8c74e42b618d 100644
--- a/proxmox-log/src/lib.rs
+++ b/proxmox-log/src/lib.rs
@@ -57,7 +57,7 @@ pub fn init_logger(
         .with(
             journald_or_stderr_layer()
                 .with_filter(filter_fn(|metadata| {
-                    !LogContext::exists() || *metadata.level() >= Level::ERROR
+                    !LogContext::exists() || *metadata.level() == Level::ERROR
                 }))
                 .with_filter(log_level),
         )
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pbs-devel] applied: [PATCH] log: only print error level to syslog/stderr
  2024-10-18 11:11 [pbs-devel] [PATCH] log: only print error level to syslog/stderr Gabriel Goller
@ 2024-10-18 17:03 ` Thomas Lamprecht
  2024-10-21  7:48   ` Gabriel Goller
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Lamprecht @ 2024-10-18 17:03 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Gabriel Goller

Am 18/10/2024 um 13:11 schrieb Gabriel Goller:
> We only want to print the error level, and not all the levels below
> error to stderr/syslog.
> 
> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> ---
> 
> Note: the sign was reversed "<=" would have been correct, because we
> want to print everything that's *less* verbose than Level::ERROR, but

Yeah, this can be easily confusing w.r.t. level and ordered by higher
verbosity or higher impact..

> there is nothing lower than ERROR, so == is better.

probably stems from thinking about syslog, where there is CRIT, ALERT and
EMERG as higher (=worse) level than error.

FWIW, while all those levels are maybe a bit much, I miss at least the NOTICE
one that sits between INFO and WARNING and a higher ERROR one could be useful
for security/data-impact situations.

> 
>  proxmox-log/src/lib.rs | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
>

applied, thanks!


_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pbs-devel] applied: [PATCH] log: only print error level to syslog/stderr
  2024-10-18 17:03 ` [pbs-devel] applied: " Thomas Lamprecht
@ 2024-10-21  7:48   ` Gabriel Goller
  0 siblings, 0 replies; 3+ messages in thread
From: Gabriel Goller @ 2024-10-21  7:48 UTC (permalink / raw)
  To: Thomas Lamprecht; +Cc: Proxmox Backup Server development discussion

On 18.10.2024 19:03, Thomas Lamprecht wrote:
>Am 18/10/2024 um 13:11 schrieb Gabriel Goller:
>> We only want to print the error level, and not all the levels below
>> error to stderr/syslog.
>>
>> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
>> ---
>>
>> Note: the sign was reversed "<=" would have been correct, because we
>> want to print everything that's *less* verbose than Level::ERROR, but
>
>Yeah, this can be easily confusing w.r.t. level and ordered by higher
>verbosity or higher impact..
>
>> there is nothing lower than ERROR, so == is better.
>
>probably stems from thinking about syslog, where there is CRIT, ALERT and
>EMERG as higher (=worse) level than error.
>
>FWIW, while all those levels are maybe a bit much, I miss at least the NOTICE
>one that sits between INFO and WARNING and a higher ERROR one could be useful
>for security/data-impact situations.

Sadly that's not currently possible with tracing (it's also not really
planned), althought we could do something like:

     tracing::error!(custom_level = "emergency", "emergency log message");

and then in the custom layer read the attribute and set the syslog
EMERGENCY level.

>>
>>  proxmox-log/src/lib.rs | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>>
>
>applied, thanks!

Thanks!


_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-21  7:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-18 11:11 [pbs-devel] [PATCH] log: only print error level to syslog/stderr Gabriel Goller
2024-10-18 17:03 ` [pbs-devel] applied: " Thomas Lamprecht
2024-10-21  7:48   ` Gabriel Goller

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