aboutsummaryrefslogtreecommitdiff
path: root/src/mm-log-helpers.c
blob: 86e9a89efe9d506f417d93010d444860e7a9f582 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details:
 *
 * Copyright (C) 2022 Google, Inc.
 */

#include "mm-log-helpers.h"

static void
common_log_print_array (gpointer     log_object,
                        MMLogLevel   level,
                        const gchar *prefix,
                        GPtrArray   *print_array)
{
    guint i;

    mm_common_str_array_human_keys (print_array);
    for (i = 0; i < print_array->len; i++) {
        mm_obj_log (log_object, level, "%s%s", prefix,
                    (const gchar *)g_ptr_array_index (print_array, i));
    }
}

void
mm_log_simple_connect_properties (gpointer                   log_object,
                                  MMLogLevel                 level,
                                  const gchar               *prefix,
                                  MMSimpleConnectProperties *value)
{
    g_autoptr(GPtrArray) print_array = NULL;

    if (!mm_log_check_level_enabled (level))
      return;

    print_array = mm_simple_connect_properties_print (value, mm_log_get_show_personal_info ());
    common_log_print_array (log_object, level, prefix, print_array);
}

void
mm_log_bearer_properties (gpointer            log_object,
                          MMLogLevel          level,
                          const gchar        *prefix,
                          MMBearerProperties *value)
{
    g_autoptr(GPtrArray) print_array = NULL;

    if (!mm_log_check_level_enabled (level))
      return;

    print_array = mm_bearer_properties_print (value, mm_log_get_show_personal_info ());
    common_log_print_array (log_object, level, prefix, print_array);
}

void
mm_log_3gpp_profile (gpointer       log_object,
                     MMLogLevel     level,
                     const gchar   *prefix,
                     MM3gppProfile *value)
{
    g_autoptr(GPtrArray) print_array = NULL;

    if (!mm_log_check_level_enabled (level))
      return;

    print_array = mm_3gpp_profile_print (value, mm_log_get_show_personal_info ());
    common_log_print_array (log_object, level, prefix, print_array);
}