提交 e542d52a 编写于 作者: A Amy Griffis 提交者: Daniel Veillard

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.
上级 9147bf2a
......@@ -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();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册