From 81c1b943000a35ff2deebbdf6112f35752a08267 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Fri, 11 May 2012 09:08:20 +0200 Subject: qmicli: new `--silent' option We will avoid every log in the `--silent' option, even the error and warning ones. --- cli/qmicli.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'cli') diff --git a/cli/qmicli.c b/cli/qmicli.c index e676dd1..df1b066 100644 --- a/cli/qmicli.c +++ b/cli/qmicli.c @@ -49,6 +49,7 @@ static gboolean device_open_sync_flag; static gchar *client_cid_str; static gboolean client_no_release_cid_flag; static gboolean verbose_flag; +static gboolean silent_flag; static gboolean version_flag; static GOptionEntry main_entries[] = { @@ -73,7 +74,11 @@ static GOptionEntry main_entries[] = { NULL }, { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose_flag, - "Run action with verbose logs", + "Run action with verbose logs, including the debug ones", + NULL + }, + { "silent", 0, 0, G_OPTION_ARG_NONE, &silent_flag, + "Run action with no logs; not even the error/warning ones", NULL }, { "version", 'V', 0, G_OPTION_ARG_NONE, &version_flag, @@ -114,11 +119,16 @@ log_handler (const gchar *log_domain, time_t now; gchar time_str[64]; struct tm *local_time; - gboolean err = FALSE; + gboolean err; + + /* Nothing to do if we're silent */ + if (silent_flag) + return; now = time ((time_t *) NULL); local_time = localtime (&now); strftime (time_str, 64, "%d %b %Y, %H:%M:%S", local_time); + err = FALSE; switch (log_level) { case G_LOG_LEVEL_WARNING: -- cgit v1.1