aboutsummaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-05-11 09:08:20 +0200
committerAleksander Morgado <aleksander@lanedo.com>2012-07-03 16:08:52 +0200
commit81c1b943000a35ff2deebbdf6112f35752a08267 (patch)
tree8a065208c11d007b4eaeafa97700b1a65fe55793 /cli
parent9aff1d5c1587a03a5a199a5c81563da59f70199f (diff)
downloadexternal_libqmi-81c1b943000a35ff2deebbdf6112f35752a08267.zip
external_libqmi-81c1b943000a35ff2deebbdf6112f35752a08267.tar.gz
external_libqmi-81c1b943000a35ff2deebbdf6112f35752a08267.tar.bz2
qmicli: new `--silent' option
We will avoid every log in the `--silent' option, even the error and warning ones.
Diffstat (limited to 'cli')
-rw-r--r--cli/qmicli.c14
1 files changed, 12 insertions, 2 deletions
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: