2008-11-03 04:13:42 +00:00
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
2006-02-27 04:31:52 +00:00
|
|
|
/* 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.
|
|
|
|
|
*
|
2008-06-26 18:31:52 +00:00
|
|
|
* 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.
|
2006-02-27 04:31:52 +00:00
|
|
|
*
|
2012-10-31 17:19:38 +01:00
|
|
|
* Copyright (C) 2006 - 2012 Red Hat, Inc.
|
2008-11-03 04:13:42 +00:00
|
|
|
* Copyright (C) 2006 - 2008 Novell, Inc.
|
2006-02-27 04:31:52 +00:00
|
|
|
*/
|
|
|
|
|
|
all: fix up multiple-include-guard defines
Previously, src/nm-ip4-config.h, libnm/nm-ip4-config.h, and
libnm-glib/nm-ip4-config.h all used "NM_IP4_CONFIG_H" as an include
guard, which meant that nm-test-utils.h could not tell which of them
was being included (and so, eg, if you tried to include
nm-ip4-config.h in a libnm test, it would fail to compile because
nm-test-utils.h was referring to symbols in src/nm-ip4-config.h).
Fix this by changing the include guards in the non-API-stable parts of
the tree:
- libnm-glib/nm-ip4-config.h remains NM_IP4_CONFIG_H
- libnm/nm-ip4-config.h now uses __NM_IP4_CONFIG_H__
- src/nm-ip4-config.h now uses __NETWORKMANAGER_IP4_CONFIG_H__
And likewise for all other headers.
The two non-"nm"-prefixed headers, libnm/NetworkManager.h and
src/NetworkManagerUtils.h are now __NETWORKMANAGER_H__ and
__NETWORKMANAGER_UTILS_H__ respectively, which, while not entirely
consistent with the general scheme, do still mostly make sense in
isolation.
2014-08-13 14:10:11 -04:00
|
|
|
#ifndef __NETWORKMANAGER_LOGGING_H__
|
|
|
|
|
#define __NETWORKMANAGER_LOGGING_H__
|
2006-02-27 04:31:52 +00:00
|
|
|
|
2014-04-14 12:03:05 +02:00
|
|
|
#ifdef __NM_TEST_UTILS_H__
|
|
|
|
|
#error nm-test-utils.h must be included as last header
|
|
|
|
|
#endif
|
|
|
|
|
|
2018-12-28 15:31:23 +01:00
|
|
|
#include "nm-utils/nm-logging-fwd.h"
|
|
|
|
|
|
2018-06-21 09:21:57 +02:00
|
|
|
#define NM_LOG_CONFIG_BACKEND_DEBUG "debug"
|
|
|
|
|
#define NM_LOG_CONFIG_BACKEND_SYSLOG "syslog"
|
|
|
|
|
#define NM_LOG_CONFIG_BACKEND_JOURNAL "journal"
|
|
|
|
|
|
2018-03-17 16:41:32 +01:00
|
|
|
static inline NMLogDomain
|
|
|
|
|
LOGD_IP_from_af (int addr_family)
|
|
|
|
|
{
|
|
|
|
|
switch (addr_family) {
|
|
|
|
|
case AF_INET: return LOGD_IP4;
|
|
|
|
|
case AF_INET6: return LOGD_IP6;
|
|
|
|
|
}
|
|
|
|
|
g_return_val_if_reached (LOGD_NONE);
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-01 10:20:01 +00:00
|
|
|
#define nm_log_err(domain, ...) nm_log (LOGL_ERR, (domain), NULL, NULL, __VA_ARGS__)
|
|
|
|
|
#define nm_log_warn(domain, ...) nm_log (LOGL_WARN, (domain), NULL, NULL, __VA_ARGS__)
|
|
|
|
|
#define nm_log_info(domain, ...) nm_log (LOGL_INFO, (domain), NULL, NULL, __VA_ARGS__)
|
|
|
|
|
#define nm_log_dbg(domain, ...) nm_log (LOGL_DEBUG, (domain), NULL, NULL, __VA_ARGS__)
|
|
|
|
|
#define nm_log_trace(domain, ...) nm_log (LOGL_TRACE, (domain), NULL, NULL, __VA_ARGS__)
|
2010-04-06 15:46:03 -07:00
|
|
|
|
2016-07-05 18:43:49 +02:00
|
|
|
//#define _NM_LOG_FUNC G_STRFUNC
|
|
|
|
|
#define _NM_LOG_FUNC NULL
|
|
|
|
|
|
2015-04-22 11:11:44 +02:00
|
|
|
/* A wrapper for the _nm_log_impl() function that adds call site information.
|
|
|
|
|
* Contrary to nm_log(), it unconditionally calls the function without
|
|
|
|
|
* checking whether logging for the given level and domain is enabled. */
|
2017-03-01 10:20:01 +00:00
|
|
|
#define _nm_log(level, domain, error, ifname, con_uuid, ...) \
|
2015-04-22 11:11:44 +02:00
|
|
|
G_STMT_START { \
|
2016-07-05 18:43:49 +02:00
|
|
|
_nm_log_impl (__FILE__, __LINE__, \
|
|
|
|
|
_NM_LOG_FUNC, \
|
|
|
|
|
(level), \
|
|
|
|
|
(domain), \
|
|
|
|
|
(error), \
|
2017-03-01 10:20:01 +00:00
|
|
|
(ifname), \
|
|
|
|
|
(con_uuid), \
|
2016-07-05 18:43:49 +02:00
|
|
|
""__VA_ARGS__); \
|
2015-04-22 11:11:44 +02:00
|
|
|
} G_STMT_END
|
|
|
|
|
|
2018-04-18 14:13:28 +02:00
|
|
|
/* nm_log() only evaluates its argument list after checking
|
2014-02-12 11:44:12 +01:00
|
|
|
* whether logging for the given level/domain is enabled. */
|
2017-03-01 10:20:01 +00:00
|
|
|
#define nm_log(level, domain, ifname, con_uuid, ...) \
|
2014-02-12 11:44:12 +01:00
|
|
|
G_STMT_START { \
|
|
|
|
|
if (nm_logging_enabled ((level), (domain))) { \
|
2017-03-01 10:20:01 +00:00
|
|
|
_nm_log (level, domain, 0, ifname, con_uuid, __VA_ARGS__); \
|
2014-02-12 11:44:12 +01:00
|
|
|
} \
|
|
|
|
|
} G_STMT_END
|
2010-04-06 15:23:08 -07:00
|
|
|
|
2017-03-01 10:20:01 +00:00
|
|
|
#define _nm_log_ptr(level, domain, ifname, con_uuid, self, prefix, ...) \
|
|
|
|
|
nm_log ((level), \
|
|
|
|
|
(domain), \
|
|
|
|
|
(ifname), \
|
|
|
|
|
(con_uuid), \
|
|
|
|
|
"%s[%p] " _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
|
|
|
|
|
(prefix) ?: "", \
|
|
|
|
|
self _NM_UTILS_MACRO_REST(__VA_ARGS__))
|
2014-02-12 21:54:26 +01:00
|
|
|
|
2017-10-30 14:41:01 +01:00
|
|
|
static inline gboolean
|
|
|
|
|
_nm_log_ptr_is_debug (NMLogLevel level)
|
|
|
|
|
{
|
|
|
|
|
return level <= LOGL_DEBUG;
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-12 21:54:26 +01:00
|
|
|
/* log a message for an object (with providing a generic @self pointer) */
|
2017-03-01 10:20:01 +00:00
|
|
|
#define nm_log_ptr(level, domain, ifname, con_uuid, self, prefix, ...) \
|
2014-02-12 21:54:26 +01:00
|
|
|
G_STMT_START { \
|
2017-10-30 14:41:01 +01:00
|
|
|
if (_nm_log_ptr_is_debug (level)) { \
|
2017-03-01 10:20:01 +00:00
|
|
|
_nm_log_ptr ((level), \
|
|
|
|
|
(domain), \
|
|
|
|
|
(ifname), \
|
|
|
|
|
(con_uuid), \
|
|
|
|
|
(self), \
|
|
|
|
|
(prefix), \
|
|
|
|
|
__VA_ARGS__); \
|
2014-02-12 21:54:26 +01:00
|
|
|
} else { \
|
2016-03-03 09:20:00 +01:00
|
|
|
const char *__prefix = (prefix); \
|
|
|
|
|
\
|
2017-03-01 10:20:01 +00:00
|
|
|
nm_log ((level), \
|
|
|
|
|
(domain), \
|
|
|
|
|
(ifname), \
|
|
|
|
|
(con_uuid), \
|
|
|
|
|
"%s%s" _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
|
|
|
|
|
__prefix ?: "", \
|
|
|
|
|
__prefix ? " " : "" _NM_UTILS_MACRO_REST(__VA_ARGS__)); \
|
2014-02-12 21:54:26 +01:00
|
|
|
} \
|
|
|
|
|
} G_STMT_END
|
|
|
|
|
|
2017-03-01 10:20:01 +00:00
|
|
|
#define _nm_log_obj(level, domain, ifname, con_uuid, self, prefix, ...) \
|
|
|
|
|
_nm_log_ptr ((level), \
|
|
|
|
|
(domain), \
|
|
|
|
|
(ifname), \
|
|
|
|
|
(con_uuid), \
|
|
|
|
|
(self), \
|
|
|
|
|
prefix, \
|
|
|
|
|
__VA_ARGS__)
|
2014-02-12 21:54:26 +01:00
|
|
|
|
|
|
|
|
/* log a message for an object (with providing a @self pointer to a GObject).
|
|
|
|
|
* Contrary to nm_log_ptr(), @self must be a GObject type (or %NULL).
|
|
|
|
|
* As of now, nm_log_obj() is identical to nm_log_ptr(), but we might change that */
|
2017-03-01 10:20:01 +00:00
|
|
|
#define nm_log_obj(level, domain, ifname, con_uuid, self, prefix, ...) \
|
|
|
|
|
nm_log_ptr ((level), \
|
|
|
|
|
(domain), \
|
|
|
|
|
(ifname), \
|
|
|
|
|
(con_uuid), \
|
|
|
|
|
(self), \
|
|
|
|
|
prefix, \
|
|
|
|
|
__VA_ARGS__)
|
2014-02-12 21:54:26 +01:00
|
|
|
|
2014-02-12 11:17:26 +01:00
|
|
|
const char *nm_logging_level_to_string (void);
|
2014-02-12 11:30:29 +01:00
|
|
|
const char *nm_logging_domains_to_string (void);
|
2016-05-19 19:05:43 +02:00
|
|
|
|
|
|
|
|
extern NMLogDomain _nm_logging_enabled_state[_LOGL_N_REAL];
|
|
|
|
|
static inline gboolean
|
|
|
|
|
nm_logging_enabled (NMLogLevel level, NMLogDomain domain)
|
|
|
|
|
{
|
|
|
|
|
nm_assert (((guint) level) < G_N_ELEMENTS (_nm_logging_enabled_state));
|
2016-05-20 18:02:56 +02:00
|
|
|
return (((guint) level) < G_N_ELEMENTS (_nm_logging_enabled_state))
|
|
|
|
|
&& !!(_nm_logging_enabled_state[level] & domain);
|
2016-05-19 19:05:43 +02:00
|
|
|
}
|
2010-05-04 12:06:00 -07:00
|
|
|
|
2016-05-23 10:56:27 +02:00
|
|
|
NMLogLevel nm_logging_get_level (NMLogDomain domain);
|
|
|
|
|
|
2013-03-11 12:23:57 -04:00
|
|
|
const char *nm_logging_all_levels_to_string (void);
|
|
|
|
|
const char *nm_logging_all_domains_to_string (void);
|
|
|
|
|
|
2013-11-26 11:33:42 -05:00
|
|
|
gboolean nm_logging_setup (const char *level,
|
|
|
|
|
const char *domains,
|
|
|
|
|
char **bad_domains,
|
|
|
|
|
GError **error);
|
2016-10-05 15:25:08 +02:00
|
|
|
|
2019-01-16 16:16:49 +01:00
|
|
|
void nm_logging_init_pre (const char *syslog_identifier,
|
|
|
|
|
char *prefix_take);
|
|
|
|
|
|
|
|
|
|
void nm_logging_init (const char *logging_backend, gboolean debug);
|
2016-10-05 15:25:08 +02:00
|
|
|
|
2016-05-23 12:02:31 +02:00
|
|
|
gboolean nm_logging_syslog_enabled (void);
|
2006-02-27 04:31:52 +00:00
|
|
|
|
2015-08-20 00:07:14 +02:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
/* This is the default definition of _NMLOG_ENABLED(). Special implementations
|
|
|
|
|
* might want to undef this and redefine it. */
|
|
|
|
|
#define _NMLOG_ENABLED(level) ( nm_logging_enabled ((level), (_NMLOG_DOMAIN)) )
|
|
|
|
|
|
2015-11-06 12:58:55 +01:00
|
|
|
#define _LOGT(...) _NMLOG (LOGL_TRACE, __VA_ARGS__)
|
2015-08-20 00:07:14 +02:00
|
|
|
#define _LOGD(...) _NMLOG (LOGL_DEBUG, __VA_ARGS__)
|
|
|
|
|
#define _LOGI(...) _NMLOG (LOGL_INFO , __VA_ARGS__)
|
|
|
|
|
#define _LOGW(...) _NMLOG (LOGL_WARN , __VA_ARGS__)
|
|
|
|
|
#define _LOGE(...) _NMLOG (LOGL_ERR , __VA_ARGS__)
|
|
|
|
|
|
2015-11-06 12:58:55 +01:00
|
|
|
#define _LOGT_ENABLED(...) _NMLOG_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
|
2015-08-20 00:07:14 +02:00
|
|
|
#define _LOGD_ENABLED(...) _NMLOG_ENABLED (LOGL_DEBUG, ##__VA_ARGS__)
|
|
|
|
|
#define _LOGI_ENABLED(...) _NMLOG_ENABLED (LOGL_INFO , ##__VA_ARGS__)
|
|
|
|
|
#define _LOGW_ENABLED(...) _NMLOG_ENABLED (LOGL_WARN , ##__VA_ARGS__)
|
|
|
|
|
#define _LOGE_ENABLED(...) _NMLOG_ENABLED (LOGL_ERR , ##__VA_ARGS__)
|
|
|
|
|
|
2016-02-05 10:49:48 +01:00
|
|
|
#define _LOGT_err(errsv, ...) _NMLOG_err (errsv, LOGL_TRACE, __VA_ARGS__)
|
|
|
|
|
#define _LOGD_err(errsv, ...) _NMLOG_err (errsv, LOGL_DEBUG, __VA_ARGS__)
|
|
|
|
|
#define _LOGI_err(errsv, ...) _NMLOG_err (errsv, LOGL_INFO , __VA_ARGS__)
|
|
|
|
|
#define _LOGW_err(errsv, ...) _NMLOG_err (errsv, LOGL_WARN , __VA_ARGS__)
|
|
|
|
|
#define _LOGE_err(errsv, ...) _NMLOG_err (errsv, LOGL_ERR , __VA_ARGS__)
|
|
|
|
|
|
2015-11-06 12:58:55 +01:00
|
|
|
/* _LOGT() and _LOGt() both log with level TRACE, but the latter is disabled by default,
|
2015-08-20 00:07:14 +02:00
|
|
|
* unless building with --with-more-logging. */
|
2018-08-26 19:45:22 +02:00
|
|
|
#if NM_MORE_LOGGING
|
2016-02-05 10:49:48 +01:00
|
|
|
#define _LOGt_ENABLED(...) _NMLOG_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
|
|
|
|
|
#define _LOGt(...) _NMLOG (LOGL_TRACE, __VA_ARGS__)
|
|
|
|
|
#define _LOGt_err(errsv, ...) _NMLOG_err (errsv, LOGL_TRACE, __VA_ARGS__)
|
2015-08-20 00:07:14 +02:00
|
|
|
#else
|
2015-08-30 16:05:44 +02:00
|
|
|
/* still call the logging macros to get compile time checks, but they will be optimized out. */
|
2016-02-05 10:49:48 +01:00
|
|
|
#define _LOGt_ENABLED(...) ( FALSE && (_NMLOG_ENABLED (LOGL_TRACE, ##__VA_ARGS__)) )
|
|
|
|
|
#define _LOGt(...) G_STMT_START { if (FALSE) { _NMLOG (LOGL_TRACE, __VA_ARGS__); } } G_STMT_END
|
|
|
|
|
#define _LOGt_err(errsv, ...) G_STMT_START { if (FALSE) { _NMLOG_err (errsv, LOGL_TRACE, __VA_ARGS__); } } G_STMT_END
|
2015-08-20 00:07:14 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2015-08-30 16:05:44 +02:00
|
|
|
/* Some implementation define a second set of logging macros, for a separate
|
2017-05-11 12:08:02 +02:00
|
|
|
* use. As with the _LOGD() macro family above, the exact implementation
|
2015-08-30 16:05:44 +02:00
|
|
|
* depends on the file that uses them.
|
|
|
|
|
* Still, it encourages a common pattern to have the common set of macros
|
2016-02-05 10:48:05 +01:00
|
|
|
* like _LOG2D(), _LOG2I(), etc. and have _LOG2t() which by default
|
2015-08-30 16:05:44 +02:00
|
|
|
* is disabled at compile time. */
|
|
|
|
|
|
|
|
|
|
#define _NMLOG2_ENABLED(level) ( nm_logging_enabled ((level), (_NMLOG2_DOMAIN)) )
|
|
|
|
|
|
2016-02-05 10:48:05 +01:00
|
|
|
#define _LOG2T(...) _NMLOG2 (LOGL_TRACE, __VA_ARGS__)
|
2015-08-30 16:05:44 +02:00
|
|
|
#define _LOG2D(...) _NMLOG2 (LOGL_DEBUG, __VA_ARGS__)
|
|
|
|
|
#define _LOG2I(...) _NMLOG2 (LOGL_INFO , __VA_ARGS__)
|
|
|
|
|
#define _LOG2W(...) _NMLOG2 (LOGL_WARN , __VA_ARGS__)
|
|
|
|
|
#define _LOG2E(...) _NMLOG2 (LOGL_ERR , __VA_ARGS__)
|
|
|
|
|
|
2016-02-05 10:48:05 +01:00
|
|
|
#define _LOG2T_ENABLED(...) _NMLOG2_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
|
2015-08-30 16:05:44 +02:00
|
|
|
#define _LOG2D_ENABLED(...) _NMLOG2_ENABLED (LOGL_DEBUG, ##__VA_ARGS__)
|
|
|
|
|
#define _LOG2I_ENABLED(...) _NMLOG2_ENABLED (LOGL_INFO , ##__VA_ARGS__)
|
|
|
|
|
#define _LOG2W_ENABLED(...) _NMLOG2_ENABLED (LOGL_WARN , ##__VA_ARGS__)
|
|
|
|
|
#define _LOG2E_ENABLED(...) _NMLOG2_ENABLED (LOGL_ERR , ##__VA_ARGS__)
|
|
|
|
|
|
2016-02-05 10:49:48 +01:00
|
|
|
#define _LOG2T_err(errsv, ...) _NMLOG2_err (errsv, LOGL_TRACE, __VA_ARGS__)
|
|
|
|
|
#define _LOG2D_err(errsv, ...) _NMLOG2_err (errsv, LOGL_DEBUG, __VA_ARGS__)
|
|
|
|
|
#define _LOG2I_err(errsv, ...) _NMLOG2_err (errsv, LOGL_INFO , __VA_ARGS__)
|
|
|
|
|
#define _LOG2W_err(errsv, ...) _NMLOG2_err (errsv, LOGL_WARN , __VA_ARGS__)
|
|
|
|
|
#define _LOG2E_err(errsv, ...) _NMLOG2_err (errsv, LOGL_ERR , __VA_ARGS__)
|
|
|
|
|
|
2018-08-26 19:45:22 +02:00
|
|
|
#if NM_MORE_LOGGING
|
2016-02-05 10:49:48 +01:00
|
|
|
#define _LOG2t_ENABLED(...) _NMLOG2_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
|
|
|
|
|
#define _LOG2t(...) _NMLOG2 (LOGL_TRACE, __VA_ARGS__)
|
|
|
|
|
#define _LOG2t_err(errsv, ...) _NMLOG2_err (errsv, LOGL_TRACE, __VA_ARGS__)
|
2015-08-30 16:05:44 +02:00
|
|
|
#else
|
|
|
|
|
/* still call the logging macros to get compile time checks, but they will be optimized out. */
|
2016-02-05 10:49:48 +01:00
|
|
|
#define _LOG2t_ENABLED(...) ( FALSE && (_NMLOG2_ENABLED (LOGL_TRACE, ##__VA_ARGS__)) )
|
|
|
|
|
#define _LOG2t(...) G_STMT_START { if (FALSE) { _NMLOG2 (LOGL_TRACE, __VA_ARGS__); } } G_STMT_END
|
|
|
|
|
#define _LOG2t_err(errsv, ...) G_STMT_START { if (FALSE) { _NMLOG2_err (errsv, LOGL_TRACE, __VA_ARGS__); } } G_STMT_END
|
2015-08-30 16:05:44 +02:00
|
|
|
#endif
|
|
|
|
|
|
2017-06-07 12:47:27 +02:00
|
|
|
#define _NMLOG3_ENABLED(level) ( nm_logging_enabled ((level), (_NMLOG3_DOMAIN)) )
|
|
|
|
|
|
|
|
|
|
#define _LOG3T(...) _NMLOG3 (LOGL_TRACE, __VA_ARGS__)
|
|
|
|
|
#define _LOG3D(...) _NMLOG3 (LOGL_DEBUG, __VA_ARGS__)
|
|
|
|
|
#define _LOG3I(...) _NMLOG3 (LOGL_INFO , __VA_ARGS__)
|
|
|
|
|
#define _LOG3W(...) _NMLOG3 (LOGL_WARN , __VA_ARGS__)
|
|
|
|
|
#define _LOG3E(...) _NMLOG3 (LOGL_ERR , __VA_ARGS__)
|
|
|
|
|
|
|
|
|
|
#define _LOG3T_ENABLED(...) _NMLOG3_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
|
|
|
|
|
#define _LOG3D_ENABLED(...) _NMLOG3_ENABLED (LOGL_DEBUG, ##__VA_ARGS__)
|
|
|
|
|
#define _LOG3I_ENABLED(...) _NMLOG3_ENABLED (LOGL_INFO , ##__VA_ARGS__)
|
|
|
|
|
#define _LOG3W_ENABLED(...) _NMLOG3_ENABLED (LOGL_WARN , ##__VA_ARGS__)
|
|
|
|
|
#define _LOG3E_ENABLED(...) _NMLOG3_ENABLED (LOGL_ERR , ##__VA_ARGS__)
|
|
|
|
|
|
|
|
|
|
#define _LOG3T_err(errsv, ...) _NMLOG3_err (errsv, LOGL_TRACE, __VA_ARGS__)
|
|
|
|
|
#define _LOG3D_err(errsv, ...) _NMLOG3_err (errsv, LOGL_DEBUG, __VA_ARGS__)
|
|
|
|
|
#define _LOG3I_err(errsv, ...) _NMLOG3_err (errsv, LOGL_INFO , __VA_ARGS__)
|
|
|
|
|
#define _LOG3W_err(errsv, ...) _NMLOG3_err (errsv, LOGL_WARN , __VA_ARGS__)
|
|
|
|
|
#define _LOG3E_err(errsv, ...) _NMLOG3_err (errsv, LOGL_ERR , __VA_ARGS__)
|
|
|
|
|
|
2018-08-26 19:45:22 +02:00
|
|
|
#if NM_MORE_LOGGING
|
2017-06-07 12:47:27 +02:00
|
|
|
#define _LOG3t_ENABLED(...) _NMLOG3_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
|
|
|
|
|
#define _LOG3t(...) _NMLOG3 (LOGL_TRACE, __VA_ARGS__)
|
|
|
|
|
#define _LOG3t_err(errsv, ...) _NMLOG3_err (errsv, LOGL_TRACE, __VA_ARGS__)
|
|
|
|
|
#else
|
|
|
|
|
/* still call the logging macros to get compile time checks, but they will be optimized out. */
|
|
|
|
|
#define _LOG3t_ENABLED(...) ( FALSE && (_NMLOG3_ENABLED (LOGL_TRACE, ##__VA_ARGS__)) )
|
|
|
|
|
#define _LOG3t(...) G_STMT_START { if (FALSE) { _NMLOG3 (LOGL_TRACE, __VA_ARGS__); } } G_STMT_END
|
|
|
|
|
#define _LOG3t_err(errsv, ...) G_STMT_START { if (FALSE) { _NMLOG3_err (errsv, LOGL_TRACE, __VA_ARGS__); } } G_STMT_END
|
|
|
|
|
#endif
|
|
|
|
|
|
2015-08-30 16:05:44 +02:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-10-14 15:32:56 +02:00
|
|
|
#define __NMLOG_DEFAULT(level, domain, prefix, ...) \
|
|
|
|
|
G_STMT_START { \
|
2017-03-01 10:20:01 +00:00
|
|
|
nm_log ((level), (domain), NULL, NULL, \
|
2016-10-14 15:32:56 +02:00
|
|
|
"%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 { \
|
2017-03-01 10:20:01 +00:00
|
|
|
nm_log ((level), (domain), NULL, NULL, \
|
2016-10-14 15:32:56 +02:00
|
|
|
"%s[%p]: " _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
|
|
|
|
|
(prefix), \
|
|
|
|
|
(self) \
|
|
|
|
|
_NM_UTILS_MACRO_REST(__VA_ARGS__)); \
|
|
|
|
|
} G_STMT_END
|
|
|
|
|
|
2019-01-15 16:41:57 +01:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
extern void _nm_logging_clear_platform_logging_cache (void);
|
|
|
|
|
|
all: fix up multiple-include-guard defines
Previously, src/nm-ip4-config.h, libnm/nm-ip4-config.h, and
libnm-glib/nm-ip4-config.h all used "NM_IP4_CONFIG_H" as an include
guard, which meant that nm-test-utils.h could not tell which of them
was being included (and so, eg, if you tried to include
nm-ip4-config.h in a libnm test, it would fail to compile because
nm-test-utils.h was referring to symbols in src/nm-ip4-config.h).
Fix this by changing the include guards in the non-API-stable parts of
the tree:
- libnm-glib/nm-ip4-config.h remains NM_IP4_CONFIG_H
- libnm/nm-ip4-config.h now uses __NM_IP4_CONFIG_H__
- src/nm-ip4-config.h now uses __NETWORKMANAGER_IP4_CONFIG_H__
And likewise for all other headers.
The two non-"nm"-prefixed headers, libnm/NetworkManager.h and
src/NetworkManagerUtils.h are now __NETWORKMANAGER_H__ and
__NETWORKMANAGER_UTILS_H__ respectively, which, while not entirely
consistent with the general scheme, do still mostly make sense in
isolation.
2014-08-13 14:10:11 -04:00
|
|
|
#endif /* __NETWORKMANAGER_LOGGING_H__ */
|