log: enable QMI traces when showing debug logs

Use the new `qmi_utils_set_traces_enabled()' to specify that we want QMI traces
when running with DEBUG logs.

Sync with libqmi:

commit 35dcb4bb6ed2755d968cf97d69faff9ed5f6871f
Author: Aleksander Morgado <aleksander@lanedo.com>
Date:   Tue Oct 9 13:44:16 2012 +0200

    libqmi-glib: message traces compiled always

    Message traces have been very useful when debugging issues in the protocol, and
    we should avoid requiring a full recompilation in order to get them enabled.

    Instead, we provide two new API methods, `qmi_utils_(get|set)_traces_enabled()',
    which allow specifying whether traces should be dumped with g_debug() or not.
This commit is contained in:
Aleksander Morgado
2012-10-09 16:28:46 +02:00
parent 927889edbe
commit f1bcc531a3

View File

@@ -27,6 +27,10 @@
#include <ModemManager.h> #include <ModemManager.h>
#include <mm-errors-types.h> #include <mm-errors-types.h>
#if defined WITH_QMI
#include <libqmi-glib.h>
#endif
#include "mm-log.h" #include "mm-log.h"
enum { enum {
@@ -179,9 +183,15 @@ mm_log_set_level (const char *level, GError **error)
break; break;
} }
} }
if (!found) if (!found)
g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS, g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
"Unknown log level '%s'", level); "Unknown log level '%s'", level);
#if defined WITH_QMI
qmi_utils_set_traces_enabled (log_level & LOGL_DEBUG ? TRUE : FALSE);
#endif
return found; return found;
} }