NetworkManager/src/nm-logging.h

131 lines
4.4 KiB
C
Raw Normal View History

/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* NetworkManager -- Network link manager
*
* 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.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright (C) 2006 - 2012 Red Hat, Inc.
* Copyright (C) 2006 - 2008 Novell, Inc.
*/
#ifndef NM_LOGGING_H
#define NM_LOGGING_H
#ifdef __NM_TEST_UTILS_H__
#error nm-test-utils.h must be included as last header
#endif
#include <glib.h>
#include <glib-object.h>
/* Log domains */
enum {
2013-08-16 12:25:21 -04:00
LOGD_NONE = 0LL,
LOGD_PLATFORM = (1LL << 1), /* Platform services */
LOGD_RFKILL = (1LL << 2),
LOGD_ETHER = (1LL << 3),
LOGD_WIFI = (1LL << 4),
LOGD_BT = (1LL << 5),
LOGD_MB = (1LL << 6), /* mobile broadband */
LOGD_DHCP4 = (1LL << 7),
LOGD_DHCP6 = (1LL << 8),
LOGD_PPP = (1LL << 9),
LOGD_WIFI_SCAN = (1LL << 10),
LOGD_IP4 = (1LL << 11),
LOGD_IP6 = (1LL << 12),
LOGD_AUTOIP4 = (1LL << 13),
LOGD_DNS = (1LL << 14),
LOGD_VPN = (1LL << 15),
LOGD_SHARING = (1LL << 16), /* Connection sharing/dnsmasq */
LOGD_SUPPLICANT = (1LL << 17), /* WiFi and 802.1x */
LOGD_AGENTS = (1LL << 18), /* Secret agents */
LOGD_SETTINGS = (1LL << 19), /* Settings */
LOGD_SUSPEND = (1LL << 20), /* Suspend/Resume */
LOGD_CORE = (1LL << 21), /* Core daemon and policy stuff */
LOGD_DEVICE = (1LL << 22), /* Device state and activation */
LOGD_OLPC = (1LL << 23),
2013-08-16 12:25:21 -04:00
LOGD_WIMAX = (1LL << 24),
LOGD_INFINIBAND = (1LL << 25),
LOGD_FIREWALL = (1LL << 26),
LOGD_ADSL = (1LL << 27),
LOGD_BOND = (1LL << 28),
LOGD_VLAN = (1LL << 29),
LOGD_BRIDGE = (1LL << 30),
LOGD_DBUS_PROPS = (1LL << 31),
LOGD_TEAM = (1LL << 32),
LOGD_CONCHECK = (1LL << 33),
2013-10-03 21:38:59 -05:00
LOGD_DCB = (1LL << 34), /* Data Center Bridging */
LOGD_DISPATCH = (1LL << 35),
};
2010-04-06 18:06:36 -07:00
#define LOGD_DHCP (LOGD_DHCP4 | LOGD_DHCP6)
#define LOGD_IP (LOGD_IP4 | LOGD_IP6)
2013-01-23 10:25:18 +01:00
#define LOGD_HW LOGD_PLATFORM
2010-04-06 18:06:36 -07:00
/* Log levels */
enum {
LOGL_DEBUG,
LOGL_INFO,
LOGL_WARN,
LOGL_ERR,
LOGL_MAX
};
typedef enum {
NM_LOGGING_ERROR_UNKNOWN_LEVEL = 0, /*< nick=UnknownLevel >*/
NM_LOGGING_ERROR_UNKNOWN_DOMAIN = 1, /*< nick=UnknownDomain >*/
} NMLoggingError;
#define NM_LOGGING_ERROR (nm_logging_error_quark ())
GQuark nm_logging_error_quark (void);
#define nm_log_err(domain, ...) nm_log (LOGL_ERR, (domain), __VA_ARGS__)
#define nm_log_warn(domain, ...) nm_log (LOGL_WARN, (domain), __VA_ARGS__)
#define nm_log_info(domain, ...) nm_log (LOGL_INFO, (domain), __VA_ARGS__)
#define nm_log_dbg(domain, ...) nm_log (LOGL_DEBUG, (domain), __VA_ARGS__)
2010-04-06 15:46:03 -07:00
/* nm_log() only evaluates it's argument list after checking
* whether logging for the given level/domain is enabled. */
#define nm_log(level, domain, ...) \
G_STMT_START { \
if (nm_logging_enabled ((level), (domain))) { \
_nm_log (G_STRLOC, G_STRFUNC, (level), (domain), __VA_ARGS__); \
} \
} G_STMT_END
void _nm_log (const char *loc,
const char *func,
guint32 level,
guint64 domain,
const char *fmt,
...) __attribute__((__format__ (__printf__, 5, 6)));
const char *nm_logging_level_to_string (void);
const char *nm_logging_domains_to_string (void);
gboolean nm_logging_enabled (guint32 level, guint64 domain);
const char *nm_logging_all_levels_to_string (void);
const char *nm_logging_all_domains_to_string (void);
gboolean nm_logging_setup (const char *level,
const char *domains,
char **bad_domains,
GError **error);
void nm_logging_syslog_openlog (gboolean debug);
void nm_logging_syslog_closelog (void);
2007-02-19 Tambet Ingo <tambet@ximian.com> * src/vpn-manager/nm-vpn-manager.c: Handle the DBUS state changes itself. Handle device state changes and disconnect VPN if it's device deactivates. * src/nm-dbus-nm.c: * src/nm-dbus-nm.h: * src/nm-dbus-device.c: * src/nm-dbus-device.c: * src/nm-dbus-net.c: * src/nm-dbus-net.h: Remove. All of it is implemented byt the new dbus API. * src/NetworkManagerMain.h: Get rid of all but 3 properties of NMData. * src/nm-device.c (nm_device_get_by_udi): (nm_device_get_by_iface): Remove. This doesn't belong here and is already implemented in the correct location (NMManager). Rip out all the test_device stuff. * src/NetworkManagerPolicy.c: Remove the leftover activation success and failure handlers, it's all done by NMDevice already. * src/NetworkManager.c: Move the signal handling here from nm-logging.c Remove the iochannel hack to route the unix signals to the main thread since we're not threaded anymore. * src/NetworkManagerAP.c: Implement HWAddress property. * src/NetworkManagerDbus.c: Remove the dbus signal sending code, it happens automatically with dbus-glib. * src/nm-netlink-monitor.c: * src/nm-netlink-monitor.h: - Move it low in the class hierarchy, don't reference any NM types. - Remove private data from the header. - Use type safe checks in public API methods. - Make it a singleton so we don't have to pass the single reference around. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2339 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-02-19 13:09:32 +00:00
#endif /* NM_LOGGING_H */