From e542d52a7c3a2f63240657ca1e8ff1580bf9b6e2 Mon Sep 17 00:00:00 2001 From: Amy Griffis Date: Thu, 6 Aug 2009 15:50:40 +0200 Subject: [PATCH] Cleanup VIR_LOG_DEBUG parsing in eventtest * tests/eventtest.c: don't covert high priority levels to debug level. Consider an invalid priority level setting a setup failure. --- tests/eventtest.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/eventtest.c b/tests/eventtest.c index ff74b043e9..05fe3f3a57 100644 --- a/tests/eventtest.c +++ b/tests/eventtest.c @@ -272,15 +272,19 @@ mymain(int argc, char **argv) if (virThreadInitialize() < 0) return EXIT_FAILURE; char *debugEnv = getenv("LIBVIRT_DEBUG"); - if (debugEnv && *debugEnv && *debugEnv != '0') { - if (STREQ(debugEnv, "2") || STREQ(debugEnv, "info")) + if (debugEnv && *debugEnv) { + if (STREQ(debugEnv, "1") || STREQ(debugEnv, "debug")) + virLogSetDefaultPriority(VIR_LOG_DEBUG); + else if (STREQ(debugEnv, "2") || STREQ(debugEnv, "info")) virLogSetDefaultPriority(VIR_LOG_INFO); else if (STREQ(debugEnv, "3") || STREQ(debugEnv, "warning")) virLogSetDefaultPriority(VIR_LOG_WARN); else if (STREQ(debugEnv, "4") || STREQ(debugEnv, "error")) virLogSetDefaultPriority(VIR_LOG_ERROR); - else - virLogSetDefaultPriority(VIR_LOG_DEBUG); + else { + fprintf(stderr, "Invalid log level setting.\n"); + return EXIT_FAILURE; + } } virEventInit();