diff mbox series

[pseudo] pseudo_util: Add default log severity values

Message ID 20260610132830.84003-1-frezidok1@gmail.com
State New
Headers show
Series [pseudo] pseudo_util: Add default log severity values | expand

Commit Message

Dmitry Sakhonchik June 10, 2026, 1:28 p.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>
---
 pseudo.h      | 2 ++
 pseudo_util.c | 7 ++++---
 2 files changed, 6 insertions(+), 3 deletions(-)
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);
 }