diff options
author | Thomas Haller <thaller@redhat.com> | 2015-10-16 10:23:31 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-11-25 15:16:04 +0100 |
commit | b776301662668e1b5884e0ac6f8512e4a227cf97 (patch) | |
tree | c6413235fb7bb8f2fc43a91426e8d16aa1dd9975 | |
parent | c7cb2e8c1cb934e6f2360615c4b86da5e9bad688 (diff) | |
download | NetworkManager-b776301662668e1b5884e0ac6f8512e4a227cf97.tar.gz |
platform/tests: use "nm-test-utils.h" in "monitor.c"
This gives us a way to externally configure the logging level like:
NMTST_DEBUG=log-level=TRACE ./src/platform/tests/monitor
(cherry picked from commit ca8e40e1dcb6444aa867aad2713e6044628e11ff)
-rw-r--r-- | src/platform/tests/monitor.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/platform/tests/monitor.c b/src/platform/tests/monitor.c index 9aff104763..f1058db828 100644 --- a/src/platform/tests/monitor.c +++ b/src/platform/tests/monitor.c @@ -3,10 +3,13 @@ #include <stdlib.h> #include <syslog.h> -#include "nm-fake-platform.h" #include "nm-linux-platform.h" #include "nm-logging.h" +#include "nm-test-utils.h" + +NMTST_DEFINE (); + int main (int argc, char **argv) { @@ -16,15 +19,16 @@ main (int argc, char **argv) g_type_init (); #endif + if (!g_getenv ("G_MESSAGES_DEBUG")) + g_setenv ("G_MESSAGES_DEBUG", "all", TRUE); + + nmtst_init_with_logging (&argc, &argv, "DEBUG", "ALL"); + + nm_log_info (LOGD_PLATFORM, "platform monitor start"); + loop = g_main_loop_new (NULL, FALSE); - nm_logging_setup ("debug", NULL, NULL, NULL); - openlog (G_LOG_DOMAIN, LOG_CONS | LOG_PERROR, LOG_DAEMON); - - g_assert (argc <= 2); - if (argc > 1 && !g_strcmp0 (argv[1], "--fake")) - nm_fake_platform_setup (); - else - nm_linux_platform_setup (); + + nm_linux_platform_setup (); g_main_loop_run (loop); |