aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAleksander Morgado <aleksandermj@chromium.org>2023-03-30 19:36:14 +0000
committerAleksander Morgado <aleksandermj@chromium.org>2023-03-30 20:14:44 +0000
commit7ec71020e73e486d5070864b5c9ecaa580a68b99 (patch)
treeb011e72f099d6c3b28b472abd9ed51aa9c0654bb /test
parent5656d01099e0532dcdbfa85bf23af8c677a7d07c (diff)
test,mmsmspdu: fix verbose logging support
Diffstat (limited to 'test')
-rw-r--r--test/mmsmspdu.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/test/mmsmspdu.c b/test/mmsmspdu.c
index 3a56ffc5..2c53704b 100644
--- a/test/mmsmspdu.c
+++ b/test/mmsmspdu.c
@@ -26,7 +26,8 @@
#include <ModemManager.h>
#define _LIBMM_INSIDE_MM
#include <libmm-glib.h>
-#include "mm-log-test.h"
+
+#include "mm-log.h"
#include "mm-sms-part-3gpp.h"
#define PROGRAM_NAME "mmsmspdu"
@@ -176,6 +177,45 @@ print_version_and_exit (void)
exit (EXIT_SUCCESS);
}
+void
+_mm_log (gpointer obj,
+ const gchar *module,
+ const gchar *loc,
+ const gchar *func,
+ guint32 level,
+ const gchar *fmt,
+ ...)
+{
+ va_list args;
+ g_autofree gchar *msg = NULL;
+ const gchar *level_str = NULL;
+
+ if (!verbose_flag)
+ return;
+
+ switch (level) {
+ case MM_LOG_LEVEL_DEBUG:
+ level_str = "debug";
+ break;
+ case MM_LOG_LEVEL_WARN:
+ level_str = "warning";
+ break;
+ case MM_LOG_LEVEL_INFO:
+ level_str = "info";
+ break;
+ case MM_LOG_LEVEL_ERR:
+ level_str = "error";
+ break;
+ default:
+ break;
+ }
+
+ va_start (args, fmt);
+ msg = g_strdup_vprintf (fmt, args);
+ va_end (args);
+ g_print ("[%s] %s\n", level_str ? level_str : "unknown", msg);
+}
+
int main (int argc, char **argv)
{
GOptionContext *context;