[libvirt] [PATCH 3/5] Cleanup VIR_LOG_DEBUG parsing in eventtest
Daniel P. Berrange
berrange at redhat.com
Thu Aug 6 11:57:47 UTC 2009
On Fri, Jul 31, 2009 at 05:57:37PM -0400, Amy Griffis wrote:
> Don't covert high priority levels to debug level. Consider an invalid priority
> level setting a setup failure.
> ---
>
> tests/eventtest.c | 12 ++++++++----
> 1 files changed, 8 insertions(+), 4 deletions(-)
ACK
Daniel
>
> diff --git a/tests/eventtest.c b/tests/eventtest.c
> index ff74b04..05fe3f3 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();
>
> --
> Libvir-list mailing list
> Libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
More information about the libvir-list
mailing list