logging: don't log the function name

The function name is no longer visible in the default
logging output. It is anyway only used together with
journal logging to set "CODE_FUNC".

Drop it. It allows to remove the strings from the binary,
which decreases the object size of a default build of NetworkManager
from 2437400 to 2412824 bytes (-24k, -1%).
This commit is contained in:
Thomas Haller 2016-07-05 18:43:49 +02:00
parent 42940fd66b
commit 8583791eb3
2 changed files with 11 additions and 2 deletions

View file

@ -664,7 +664,8 @@ _nm_log_impl (const char *file,
_iovec_set_format (iov, iov_free, i_field++, "NM_LOG_DOMAINS=%s", s_domain_1);
}
_iovec_set_format (iov, iov_free, i_field++, "NM_LOG_LEVEL=%s", global.level_desc[level].name);
_iovec_set_format (iov, iov_free, i_field++, "CODE_FUNC=%s", func ?: "");
if (func)
_iovec_set_format (iov, iov_free, i_field++, "CODE_FUNC=%s", func);
_iovec_set_format (iov, iov_free, i_field++, "CODE_FILE=%s", file ?: "");
_iovec_set_format (iov, iov_free, i_field++, "CODE_LINE=%u", line);
_iovec_set_format (iov, iov_free, i_field++, "TIMESTAMP_MONOTONIC=%lld.%06lld", (long long) (now / NM_UTILS_NS_PER_SECOND), (long long) ((now % NM_UTILS_NS_PER_SECOND) / 1000));

View file

@ -103,12 +103,20 @@ typedef enum { /*< skip >*/
#define nm_log_dbg(domain, ...) nm_log (LOGL_DEBUG, (domain), __VA_ARGS__)
#define nm_log_trace(domain, ...) nm_log (LOGL_TRACE, (domain), __VA_ARGS__)
//#define _NM_LOG_FUNC G_STRFUNC
#define _NM_LOG_FUNC NULL
/* 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. */
#define _nm_log(level, domain, error, ...) \
G_STMT_START { \
_nm_log_impl (__FILE__, __LINE__, G_STRFUNC, (level), (domain), (error), ""__VA_ARGS__); \
_nm_log_impl (__FILE__, __LINE__, \
_NM_LOG_FUNC, \
(level), \
(domain), \
(error), \
""__VA_ARGS__); \
} G_STMT_END
/* nm_log() only evaluates it's argument list after checking