Commit 92a8cfac authored by Beniamino Galvani's avatar Beniamino Galvani

core: introduce default logging macros

parent f551c91d
......@@ -89,15 +89,8 @@ nm_device_factory_create (GError **error)
/*****************************************************************************/
#define _NMLOG_DOMAIN LOGD_BT
#define _NMLOG_PREFIX_NAME "bluez"
#define _NMLOG(level, ...) \
G_STMT_START { \
nm_log ((level), _NMLOG_DOMAIN, \
"%s" _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
_NMLOG_PREFIX_NAME": " \
_NM_UTILS_MACRO_REST(__VA_ARGS__)); \
} G_STMT_END
#define _NMLOG_DOMAIN LOGD_BT
#define _NMLOG(level, ...) __NMLOG_DEFAULT (level, _NMLOG_DOMAIN, "bluez", __VA_ARGS__)
/*****************************************************************************/
......
......@@ -71,15 +71,7 @@ G_DEFINE_TYPE (NMDnsDnsmasq, nm_dns_dnsmasq, NM_TYPE_DNS_PLUGIN)
/*****************************************************************************/
#define _NMLOG_DOMAIN LOGD_DNS
#define _NMLOG_PREFIX_NAME "dnsmasq"
#define _NMLOG(level, ...) \
G_STMT_START { \
nm_log ((level), _NMLOG_DOMAIN, \
"%s[%p]: " _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
_NMLOG_PREFIX_NAME, \
(self) \
_NM_UTILS_MACRO_REST(__VA_ARGS__)); \
} G_STMT_END
#define _NMLOG(level, ...) __NMLOG_DEFAULT_WITH_ADDR (level, _NMLOG_DOMAIN, "dnsmasq", __VA_ARGS__)
/*****************************************************************************/
......
......@@ -76,16 +76,8 @@ G_DEFINE_TYPE (NMDnsSystemdResolved, nm_dns_systemd_resolved, NM_TYPE_DNS_PLUGIN
/*****************************************************************************/
#define _NMLOG_DOMAIN LOGD_DNS
#define _NMLOG_PREFIX_NAME "systemd-resolved"
#define _NMLOG(level, ...) \
G_STMT_START { \
nm_log ((level), _NMLOG_DOMAIN, \
"%s[%p]: " _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
_NMLOG_PREFIX_NAME, \
(self) \
_NM_UTILS_MACRO_REST(__VA_ARGS__)); \
} G_STMT_END
#define _NMLOG_DOMAIN LOGD_DNS
#define _NMLOG(level, ...) __NMLOG_DEFAULT_WITH_ADDR (level, _NMLOG_DOMAIN, "dns-sd-resolved", __VA_ARGS__)
/*****************************************************************************/
......
......@@ -68,15 +68,8 @@ G_DEFINE_TYPE (NMDnsMasqManager, nm_dnsmasq_manager, G_TYPE_OBJECT)
/*****************************************************************************/
#define _NMLOG_DOMAIN LOGD_SHARING
#define _NMLOG_PREFIX_NAME "dnsmasq-manager"
#define _NMLOG(level, ...) \
G_STMT_START { \
nm_log ((level), _NMLOG_DOMAIN, \
"%s" _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
_NMLOG_PREFIX_NAME": " \
_NM_UTILS_MACRO_REST(__VA_ARGS__)); \
} G_STMT_END
#define _NMLOG_DOMAIN LOGD_SHARING
#define _NMLOG(level, ...) __NMLOG_DEFAULT (level, _NMLOG_DOMAIN, "dnsmasq-manager", __VA_ARGS__)
/*****************************************************************************/
......
......@@ -81,15 +81,8 @@ G_DEFINE_TYPE(NMBusManager, nm_bus_manager, G_TYPE_OBJECT)
/*****************************************************************************/
#define _NMLOG_DOMAIN LOGD_CORE
#define _NMLOG_PREFIX_NAME "bus-manager"
#define _NMLOG(level, ...) \
G_STMT_START { \
nm_log ((level), _NMLOG_DOMAIN, \
"%s" _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
_NMLOG_PREFIX_NAME": " \
_NM_UTILS_MACRO_REST(__VA_ARGS__)); \
} G_STMT_END
#define _NMLOG_DOMAIN LOGD_CORE
#define _NMLOG(level, ...) __NMLOG_DEFAULT (level, _NMLOG_DOMAIN, "bus-manager", __VA_ARGS__)
/*****************************************************************************/
......
......@@ -51,14 +51,8 @@ struct _NMCheckpointManager {
/*****************************************************************************/
#define _NMLOG_PREFIX_NAME "checkpoint"
#define _NMLOG_DOMAIN LOGD_CORE
#define _NMLOG(level, ...) \
nm_log (level, _NMLOG_DOMAIN, \
"%s: " _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
_NMLOG_PREFIX_NAME \
_NM_UTILS_MACRO_REST(__VA_ARGS__))
#define _NMLOG_DOMAIN LOGD_CORE
#define _NMLOG(level, ...) __NMLOG_DEFAULT (level, _NMLOG_DOMAIN, "checkpoint", __VA_ARGS__)
/*****************************************************************************/
......
......@@ -138,14 +138,8 @@ G_DEFINE_TYPE_WITH_CODE (NMConfig, nm_config, G_TYPE_OBJECT,
/*****************************************************************************/
#define _NMLOG_PREFIX_NAME "config"
#define _NMLOG_DOMAIN LOGD_CORE
#define _NMLOG(level, ...) \
nm_log (level, _NMLOG_DOMAIN, \
"%s: " _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
_NMLOG_PREFIX_NAME \
_NM_UTILS_MACRO_REST(__VA_ARGS__))
#define _NMLOG_DOMAIN LOGD_CORE
#define _NMLOG(level, ...) __NMLOG_DEFAULT (level, _NMLOG_DOMAIN, "config", __VA_ARGS__)
/*****************************************************************************/
......
......@@ -71,14 +71,8 @@ G_DEFINE_TYPE (NMConnectivity, nm_connectivity, G_TYPE_OBJECT)
/*****************************************************************************/
#define _NMLOG_DOMAIN LOGD_CONCHECK
#define _NMLOG(level, ...) \
G_STMT_START { \
nm_log ((level), (_NMLOG_DOMAIN), \
"%s" _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
"connectivity: " \
_NM_UTILS_MACRO_REST(__VA_ARGS__)); \
} G_STMT_END
#define _NMLOG_DOMAIN LOGD_CONCHECK
#define _NMLOG(level, ...) __NMLOG_DEFAULT (level, _NMLOG_DOMAIN, "connectivity", __VA_ARGS__)
/*****************************************************************************/
......
......@@ -42,15 +42,8 @@
#define CALL_TIMEOUT (1000 * 60 * 10) /* 10 minutes for all scripts */
#define _NMLOG_DOMAIN LOGD_DISPATCH
#define _NMLOG_PREFIX_NAME "dispatcher"
#define _NMLOG(level, ...) \
G_STMT_START { \
nm_log ((level), _NMLOG_DOMAIN, \
"%s: " _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
_NMLOG_PREFIX_NAME \
_NM_UTILS_MACRO_REST(__VA_ARGS__)); \
} G_STMT_END
#define _NMLOG_DOMAIN LOGD_DISPATCH
#define _NMLOG(level, ...) __NMLOG_DEFAULT (level, _NMLOG_DOMAIN, "dispatcher", __VA_ARGS__)
static GDBusProxy *dispatcher_proxy;
static GHashTable *requests = NULL;
......
......@@ -74,23 +74,11 @@ G_DEFINE_QUARK (NMExportedObjectClassInfo, nm_exported_object_class_info)
/*****************************************************************************/
#define _NMLOG_PREFIX_NAME "exported-object"
#define _NMLOG_DOMAIN LOGD_CORE
#define _NMLOG(level, ...) \
nm_log ((level), _NMLOG_DOMAIN, \
"%s[%p]: " _NM_UTILS_MACRO_FIRST (__VA_ARGS__), \
_NMLOG_PREFIX_NAME, (self) \
_NM_UTILS_MACRO_REST (__VA_ARGS__))
#define _NMLOG2_PREFIX_NAME "properties-changed"
#define _NMLOG2_DOMAIN LOGD_DBUS_PROPS
#define _NMLOG2(level, ...) \
nm_log ((level), _NMLOG2_DOMAIN, \
"%s[%p]: " _NM_UTILS_MACRO_FIRST (__VA_ARGS__), \
_NMLOG2_PREFIX_NAME, (self) \
_NM_UTILS_MACRO_REST (__VA_ARGS__))
#define _NMLOG_DOMAIN LOGD_CORE
#define _NMLOG(level, ...) __NMLOG_DEFAULT_WITH_ADDR (level, _NMLOG_DOMAIN, "exported-object", __VA_ARGS__)
#define _NMLOG2_DOMAIN LOGD_DBUS_PROPS
#define _NMLOG2(level, ...) __NMLOG_DEFAULT_WITH_ADDR (level, _NMLOG2_DOMAIN, "properties-changed", __VA_ARGS__)
/*****************************************************************************/
......
......@@ -275,4 +275,21 @@ extern void (*_nm_logging_clear_platform_logging_cache) (void);
/*****************************************************************************/
#define __NMLOG_DEFAULT(level, domain, prefix, ...) \
G_STMT_START { \
nm_log ((level), (domain), \
"%s: " _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
(prefix) \
_NM_UTILS_MACRO_REST(__VA_ARGS__)); \
} G_STMT_END
#define __NMLOG_DEFAULT_WITH_ADDR(level, domain, prefix, ...) \
G_STMT_START { \
nm_log ((level), (domain), \
"%s[%p]: " _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
(prefix), \
(self) \
_NM_UTILS_MACRO_REST(__VA_ARGS__)); \
} G_STMT_END
#endif /* __NETWORKMANAGER_LOGGING_H__ */
......@@ -67,16 +67,8 @@ NM_DEFINE_SINGLETON_GETTER (NMPacrunnerManager, nm_pacrunner_manager_get, NM_TYP
/*****************************************************************************/
#define _NMLOG_DOMAIN LOGD_PROXY
#define _NMLOG_PREFIX_NAME "pacrunner"
#define _NMLOG(level, ...) \
G_STMT_START { \
nm_log ((level), _NMLOG_DOMAIN, \
"%s[%p]: " _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
_NMLOG_PREFIX_NAME, \
(self) /* Beware: must not dereference @self (see pacrunner_remove_done) */\
_NM_UTILS_MACRO_REST(__VA_ARGS__)); \
} G_STMT_END
#define _NMLOG_DOMAIN LOGD_PROXY
#define _NMLOG(level, ...) __NMLOG_DEFAULT_WITH_ADDR (level, _NMLOG_DOMAIN, "pacrunner", __VA_ARGS__)
/*****************************************************************************/
......
......@@ -68,16 +68,8 @@ struct _NMSessionMonitorClass {
G_DEFINE_TYPE (NMSessionMonitor, nm_session_monitor, G_TYPE_OBJECT);
#define _NMLOG_PREFIX_NAME "session-monitor"
#define _NMLOG_DOMAIN LOGD_CORE
#define _NMLOG(level, ...) \
G_STMT_START { \
nm_log (level, _NMLOG_DOMAIN, \
"%s: " _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
_NMLOG_PREFIX_NAME \
_NM_UTILS_MACRO_REST(__VA_ARGS__)); \
} G_STMT_END
#define _NMLOG_DOMAIN LOGD_CORE
#define _NMLOG(level, ...) __NMLOG_DEFAULT (level, _NMLOG_DOMAIN, "session-monitor", __VA_ARGS__)
/*****************************************************************************/
......
......@@ -97,14 +97,8 @@ G_DEFINE_TYPE (NMSleepMonitor, nm_sleep_monitor, G_TYPE_OBJECT);
/*****************************************************************************/
#define _NMLOG_DOMAIN LOGD_SUSPEND
#define _NMLOG(level, ...) \
G_STMT_START { \
nm_log ((level), _NMLOG_DOMAIN, \
"%s: " _NM_UTILS_MACRO_FIRST (__VA_ARGS__), \
_NMLOG_PREFIX_NAME \
_NM_UTILS_MACRO_REST (__VA_ARGS__)); \
} G_STMT_END
#define _NMLOG_DOMAIN LOGD_SUSPEND
#define _NMLOG(level, ...) __NMLOG_DEFAULT (level, _NMLOG_DOMAIN, _NMLOG_PREFIX_NAME, __VA_ARGS__)
/*****************************************************************************/
......
......@@ -108,15 +108,8 @@ G_DEFINE_TYPE (NMPPPManager, nm_ppp_manager, NM_TYPE_EXPORTED_OBJECT)
/*****************************************************************************/
#define _NMLOG_DOMAIN LOGD_PPP
#define _NMLOG_PREFIX_NAME "ppp-manager"
#define _NMLOG(level, ...) \
G_STMT_START { \
nm_log ((level), _NMLOG_DOMAIN, \
"%s" _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
_NMLOG_PREFIX_NAME": " \
_NM_UTILS_MACRO_REST(__VA_ARGS__)); \
} G_STMT_END
#define _NMLOG_DOMAIN LOGD_PPP
#define _NMLOG(level, ...) __NMLOG_DEFAULT (level, _NMLOG_DOMAIN, "ppp-manager", __VA_ARGS__)
/*****************************************************************************/
......
......@@ -185,14 +185,7 @@ G_DEFINE_TYPE (NMSettings, nm_settings, NM_TYPE_EXPORTED_OBJECT);
/*****************************************************************************/
#define _NMLOG_DOMAIN LOGD_SETTINGS
#define _NMLOG_PREFIX_NAME "settings"
#define _NMLOG(level, ...) \
G_STMT_START { \
nm_log ((level), _NMLOG_DOMAIN, \
"%s" _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
_NMLOG_PREFIX_NAME": " \
_NM_UTILS_MACRO_REST(__VA_ARGS__)); \
} G_STMT_END
#define _NMLOG(level, ...) __NMLOG_DEFAULT (level, _NMLOG_DOMAIN, "settings", __VA_ARGS__)
/*****************************************************************************/
......
......@@ -58,15 +58,8 @@ G_DEFINE_TYPE (NMSupplicantManager, nm_supplicant_manager, G_TYPE_OBJECT)
/*****************************************************************************/
#define _NMLOG_DOMAIN LOGD_SUPPLICANT
#define _NMLOG_PREFIX_NAME "supplicant"
#define _NMLOG(level, ...) \
G_STMT_START { \
nm_log ((level), _NMLOG_DOMAIN, \
"%s" _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
_NMLOG_PREFIX_NAME": " \
_NM_UTILS_MACRO_REST(__VA_ARGS__)); \
} G_STMT_END
#define _NMLOG_DOMAIN LOGD_SUPPLICANT
#define _NMLOG(level, ...) __NMLOG_DEFAULT (level, _NMLOG_DOMAIN, "supplicant", __VA_ARGS__)
/*****************************************************************************/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment