nmtst: support shorthand "NMTST_DEBUG=TRACE" to set logging level

This commit is contained in:
Thomas Haller
2015-11-27 10:34:38 +01:00
parent 90683fcb3a
commit c97f7b54fe

View File

@@ -69,6 +69,8 @@
* If you set the level to DEBUG or TRACE, it also sets G_MESSAGES_DEBUG=all (unless * If you set the level to DEBUG or TRACE, it also sets G_MESSAGES_DEBUG=all (unless
* in assert-logging mode and unless G_MESSAGES_DEBUG is already defined). * in assert-logging mode and unless G_MESSAGES_DEBUG is already defined).
* *
* "TRACE", this is shorthand for "log-level=TRACE".
*
* "sudo-cmd=PATH": when running root tests as normal user, the test will execute * "sudo-cmd=PATH": when running root tests as normal user, the test will execute
* itself by invoking sudo at PATH. * itself by invoking sudo at PATH.
* For example * For example
@@ -322,6 +324,9 @@ __nmtst_init (int *argc, char ***argv, gboolean assert_logging, const char *log_
} else if (!g_ascii_strncasecmp (debug, "log-level=", strlen ("log-level="))) { } else if (!g_ascii_strncasecmp (debug, "log-level=", strlen ("log-level="))) {
g_free (c_log_level); g_free (c_log_level);
log_level = c_log_level = g_strdup (&debug[strlen ("log-level=")]); log_level = c_log_level = g_strdup (&debug[strlen ("log-level=")]);
} else if (!g_ascii_strcasecmp (debug, "TRACE")) {
g_free (c_log_level);
log_level = c_log_level = g_strdup (debug);
} else if (!g_ascii_strncasecmp (debug, "log-domains=", strlen ("log-domains="))) { } else if (!g_ascii_strncasecmp (debug, "log-domains=", strlen ("log-domains="))) {
g_free (c_log_domains); g_free (c_log_domains);
log_domains = c_log_domains = g_strdup (&debug[strlen ("log-domains=")]); log_domains = c_log_domains = g_strdup (&debug[strlen ("log-domains=")]);