mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-06 18:28:03 +02:00
libnm-glib: make properties-changed debugging available at runtime
Use an environment variable LIBNM_GLIB_DEBUG=properties-changed to indicate that properties-changed debugging messages should be printed. Also cleans up the debug output formatting.
This commit is contained in:
parent
6d2e033a0e
commit
1b773f4e6e
1 changed files with 22 additions and 14 deletions
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <nm-utils.h>
|
#include <nm-utils.h>
|
||||||
#include "NetworkManager.h"
|
#include "NetworkManager.h"
|
||||||
#include "nm-object.h"
|
#include "nm-object.h"
|
||||||
|
|
@ -33,7 +34,8 @@
|
||||||
#include "nm-types.h"
|
#include "nm-types.h"
|
||||||
#include "nm-dbus-helpers-private.h"
|
#include "nm-dbus-helpers-private.h"
|
||||||
|
|
||||||
#define DEBUG 0
|
static gboolean debug = FALSE;
|
||||||
|
#define dbgmsg(f,...) if (G_UNLIKELY (debug)) { g_message (f, ## __VA_ARGS__ ); }
|
||||||
|
|
||||||
static void nm_object_initable_iface_init (GInitableIface *iface);
|
static void nm_object_initable_iface_init (GInitableIface *iface);
|
||||||
static void nm_object_async_initable_iface_init (GAsyncInitableIface *iface);
|
static void nm_object_async_initable_iface_init (GAsyncInitableIface *iface);
|
||||||
|
|
@ -944,9 +946,7 @@ handle_property_changed (NMObject *self, const char *dbus_name, GValue *value, g
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
#if DEBUG
|
dbgmsg ("Property '%s' unhandled.", prop_name);
|
||||||
g_warning ("Property '%s' unhandled.", prop_name);
|
|
||||||
#endif
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -959,21 +959,20 @@ handle_property_changed (NMObject *self, const char *dbus_name, GValue *value, g
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
if (G_UNLIKELY (debug)) {
|
||||||
{
|
|
||||||
char *s;
|
char *s;
|
||||||
s = g_strdup_value_contents (value);
|
s = g_strdup_value_contents (value);
|
||||||
g_message ("PC: %p (%s) prop (%s) '%s' value (%s) %s",
|
dbgmsg ("PC: (%p) %s::%s => '%s' (%s%s%s)",
|
||||||
self, G_OBJECT_TYPE_NAME (self),
|
self, G_OBJECT_TYPE_NAME (self),
|
||||||
g_type_name (pspec->value_type), prop_name,
|
prop_name,
|
||||||
G_VALUE_TYPE_NAME (value), s);
|
s,
|
||||||
|
G_VALUE_TYPE_NAME (value),
|
||||||
|
pi->object_type ? " / " : "",
|
||||||
|
pi->object_type ? g_type_name (pi->object_type) : "");
|
||||||
g_free (s);
|
g_free (s);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (pi->object_type) {
|
if (pi->object_type) {
|
||||||
#if DEBUG
|
|
||||||
g_message (" Value is object type %s", g_type_name (pi->object_type));
|
|
||||||
#endif
|
|
||||||
if (G_VALUE_HOLDS (value, DBUS_TYPE_G_OBJECT_PATH))
|
if (G_VALUE_HOLDS (value, DBUS_TYPE_G_OBJECT_PATH))
|
||||||
success = handle_object_property (self, pspec->name, value, pi, synchronously);
|
success = handle_object_property (self, pspec->name, value, pi, synchronously);
|
||||||
else if (G_VALUE_HOLDS (value, DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH))
|
else if (G_VALUE_HOLDS (value, DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH))
|
||||||
|
|
@ -1095,6 +1094,8 @@ _nm_object_register_properties (NMObject *object,
|
||||||
const NMPropertiesInfo *info)
|
const NMPropertiesInfo *info)
|
||||||
{
|
{
|
||||||
NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (object);
|
NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (object);
|
||||||
|
static gsize dval = 0;
|
||||||
|
const char *debugstr;
|
||||||
NMPropertiesInfo *tmp;
|
NMPropertiesInfo *tmp;
|
||||||
GHashTable *instance;
|
GHashTable *instance;
|
||||||
|
|
||||||
|
|
@ -1102,6 +1103,13 @@ _nm_object_register_properties (NMObject *object,
|
||||||
g_return_if_fail (proxy != NULL);
|
g_return_if_fail (proxy != NULL);
|
||||||
g_return_if_fail (info != NULL);
|
g_return_if_fail (info != NULL);
|
||||||
|
|
||||||
|
if (g_once_init_enter (&dval)) {
|
||||||
|
debugstr = getenv ("LIBNM_GLIB_DEBUG");
|
||||||
|
if (debugstr && strstr (debugstr, "properties-changed"))
|
||||||
|
debug = TRUE;
|
||||||
|
g_once_init_leave (&dval, 1);
|
||||||
|
}
|
||||||
|
|
||||||
priv->property_interfaces = g_slist_prepend (priv->property_interfaces,
|
priv->property_interfaces = g_slist_prepend (priv->property_interfaces,
|
||||||
g_strdup (dbus_g_proxy_get_interface (proxy)));
|
g_strdup (dbus_g_proxy_get_interface (proxy)));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue