mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
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.
This commit is contained in:
parent
9147bf2a73
commit
e542d52a7c
@ -272,15 +272,19 @@ mymain(int argc, char **argv)
|
|||||||
if (virThreadInitialize() < 0)
|
if (virThreadInitialize() < 0)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
char *debugEnv = getenv("LIBVIRT_DEBUG");
|
char *debugEnv = getenv("LIBVIRT_DEBUG");
|
||||||
if (debugEnv && *debugEnv && *debugEnv != '0') {
|
if (debugEnv && *debugEnv) {
|
||||||
if (STREQ(debugEnv, "2") || STREQ(debugEnv, "info"))
|
if (STREQ(debugEnv, "1") || STREQ(debugEnv, "debug"))
|
||||||
|
virLogSetDefaultPriority(VIR_LOG_DEBUG);
|
||||||
|
else if (STREQ(debugEnv, "2") || STREQ(debugEnv, "info"))
|
||||||
virLogSetDefaultPriority(VIR_LOG_INFO);
|
virLogSetDefaultPriority(VIR_LOG_INFO);
|
||||||
else if (STREQ(debugEnv, "3") || STREQ(debugEnv, "warning"))
|
else if (STREQ(debugEnv, "3") || STREQ(debugEnv, "warning"))
|
||||||
virLogSetDefaultPriority(VIR_LOG_WARN);
|
virLogSetDefaultPriority(VIR_LOG_WARN);
|
||||||
else if (STREQ(debugEnv, "4") || STREQ(debugEnv, "error"))
|
else if (STREQ(debugEnv, "4") || STREQ(debugEnv, "error"))
|
||||||
virLogSetDefaultPriority(VIR_LOG_ERROR);
|
virLogSetDefaultPriority(VIR_LOG_ERROR);
|
||||||
else
|
else {
|
||||||
virLogSetDefaultPriority(VIR_LOG_DEBUG);
|
fprintf(stderr, "Invalid log level setting.\n");
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virEventInit();
|
virEventInit();
|
||||||
|
Loading…
Reference in New Issue
Block a user