Skip to contentSkip to conversation

pseudo_util: Add default log severity values

PATCH New [email protected] 1 participant 1 message Jun 10

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pseudo_util: Add default log severity values

From: Dmitry Sakhonchik <[email protected]>

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.

---
 pseudo.h      | 2 ++
 pseudo_util.c | 7 ++++---
 2 files changed, 6 insertions(+), 3 deletions(-)
pseudo.h +2 -0
index 92ae71e..66aa70e 100644
@@ -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
pseudo_util.c +4 -3
index 893a25b..4c05394 100644
@@ -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);
 }