diff mbox series

[pseudo,12/23] pseudo_util: Add default log severity values

Message ID 1783039578-31531-13-git-send-email-mark.hatle@kernel.crashing.org
State New
Headers show
Series Create new pseudo 1.99.0 version | expand

Commit Message

Mark Hatle July 3, 2026, 12:46 a.m. UTC
From: Dmitry Sakhonchik <frezidok1@gmail.com>

Default values are "show everything". If the user wants to see
only certain categories, they should explicitely set
PSEUDO_SEVERITY env var or use -k option.

Signed-off-by: Dmitry Sakhonchik <frezidok1@gmail.com>
Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
---
 pseudo.h      | 2 ++
 pseudo_util.c | 7 ++++---
 2 files changed, 6 insertions(+), 3 deletions(-)

Comments

Paul Barker July 3, 2026, 10:43 a.m. UTC | #1
On Thu, 2026-07-02 at 19:46 -0500, Mark Hatle wrote:
> From: Dmitry Sakhonchik <frezidok1@gmail.com>
> 
> Default values are "show everything". If the user wants to see
> only certain categories, they should explicitely set
> PSEUDO_SEVERITY env var or use -k option.
> 
> Signed-off-by: Dmitry Sakhonchik <frezidok1@gmail.com>
> Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
> ---
>  pseudo.h      | 2 ++
>  pseudo_util.c | 7 ++++---
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/pseudo.h b/pseudo.h
> index 92ae71e..66aa70e 100644
> --- a/pseudo.h
> +++ b/pseudo.h
> @@ -130,6 +130,8 @@ extern char *pseudo_version;
>  #define PSEUDO_PIDFILE "pseudo.pid"
>  #define PSEUDO_SOCKET "pseudo.socket"
>  
> +#define PSEUDO_SEVERITY_DEFAULT "info,warn,error"

This default is confusing. pseudo_error() doesn't check
pseudo_util_severity_flags, so errors are always printed.

This also isn't "show everything" as pseudo_debug() messages are not
shown with this default severity level. They are instead controlled by
pseudo_util_debug_flags, and having two separate sets of flags is
another level of confusion to me.

If we're overhauling the logging for v2.0, I think it would be much
better to merge the log/debug handling into one ordered list of severity
levels and control what is printed by specifying the minimum severity
level to output.

Best regards,
Dmitry Sakhonchik July 3, 2026, 12:44 p.m. UTC | #2
They are designed like that on purpose.
As far as I know, pseudo_debug was originally created as
a debugging mechanism for pseudo developers,
so it lets you choose "which part of what pseudo is doing right now I want
to look at as deeply as possible"
and often used when something goes wrong and you want to debug it.
On the contrary, pseudo_severity is the new mechanism that allows people to
sort their original regular user's log (make it less verbose).
For example, "I don't care about regular log messages, write something only
if warning or error".

These changes are implementing bug 12141
<https://bugzilla.yoctoproject.org/show_bug.cgi?id=12141> where Seebs
suggested a new separate category.

In my opinion, these two separate mechanisms should not be merged because
they serve different categories
of people and solve different categories of problems.

As for the "errors are always printed", if it's really confusing, I can
remove "error" from default lists
as it doesn't do anything, but I included it because I wanted to explicitly
show that by default we always use these 3 categories.

Thanks for the review!

пт, 3 июл. 2026 г. в 13:43, Paul Barker <paul@pbarker.dev>:

> On Thu, 2026-07-02 at 19:46 -0500, Mark Hatle wrote:
> > From: Dmitry Sakhonchik <frezidok1@gmail.com>
> >
> > Default values are "show everything". If the user wants to see
> > only certain categories, they should explicitely set
> > PSEUDO_SEVERITY env var or use -k option.
> >
> > Signed-off-by: Dmitry Sakhonchik <frezidok1@gmail.com>
> > Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
> > ---
> >  pseudo.h      | 2 ++
> >  pseudo_util.c | 7 ++++---
> >  2 files changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/pseudo.h b/pseudo.h
> > index 92ae71e..66aa70e 100644
> > --- a/pseudo.h
> > +++ b/pseudo.h
> > @@ -130,6 +130,8 @@ extern char *pseudo_version;
> >  #define PSEUDO_PIDFILE "pseudo.pid"
> >  #define PSEUDO_SOCKET "pseudo.socket"
> >
> > +#define PSEUDO_SEVERITY_DEFAULT "info,warn,error"
>
> This default is confusing. pseudo_error() doesn't check
> pseudo_util_severity_flags, so errors are always printed.
>
> This also isn't "show everything" as pseudo_debug() messages are not
> shown with this default severity level. They are instead controlled by
> pseudo_util_debug_flags, and having two separate sets of flags is
> another level of confusion to me.
>
> If we're overhauling the logging for v2.0, I think it would be much
> better to merge the log/debug handling into one ordered list of severity
> levels and control what is printed by specifying the minimum severity
> level to output.
>
> Best regards,
>
> --
> Paul Barker
>
>
diff mbox series

Patch

diff --git a/pseudo.h b/pseudo.h
index 92ae71e..66aa70e 100644
--- a/pseudo.h
+++ b/pseudo.h
@@ -130,6 +130,8 @@  extern char *pseudo_version;
 #define PSEUDO_PIDFILE "pseudo.pid"
 #define PSEUDO_SOCKET "pseudo.socket"
 
+#define PSEUDO_SEVERITY_DEFAULT "info,warn,error"
+
 /* some systems might not have *at().  We like to define operations in
  * terms of each other, and for instance, open(...) is the same as
  * openat(AT_FDCWD, ...).  If no AT_FDCWD is provided, any value that can't
diff --git a/pseudo_util.c b/pseudo_util.c
index 893a25b..4c05394 100644
--- a/pseudo_util.c
+++ b/pseudo_util.c
@@ -250,10 +250,11 @@  pseudo_init_util(void) {
 	}
 	free(env);
 	env = pseudo_get_value("PSEUDO_SEVERITY");
-	if (env) {
-		pseudo_severity_set(env);
-		pseudo_severity_flags_finalize();
+	if (!env) {
+		env = strdup(PSEUDO_SEVERITY_DEFAULT);
 	}
+	pseudo_severity_set(env);
+	pseudo_severity_flags_finalize();
 	free(env);
 }