diff options
author | Thomas Haller <thaller@redhat.com> | 2021-02-17 16:11:49 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2021-02-18 19:46:57 +0100 |
commit | 341b6e0704daf460d823c66ee83d441c26084a94 (patch) | |
tree | 4d2ad9c23a5c948d558100058720bef7ecdd14d4 /shared | |
parent | 243051a8a62a01dc34a89cf9b3ea4d3ad961805b (diff) | |
download | NetworkManager-th/libnm-core-split.tar.gz |
all: change G_LOG_DOMAIN to "nm"th/libnm-core-split
glib requires G_LOG_DOMAIN defined so that log messages are labeled
to belong to NetworkManager or libnm.
However, we don't actually want to use glib logging. Our library libnm
MUST not log anything, because it spams the user's stdout/stderr.
Instead, a library must report notable events via its API. Note that
there is also LIBNM_CLIENT_DEBUG to explicitly enable debug logging,
but that doesn't use glib logging either.
Also, the daemon does not use glib logging instead it logs to syslog.
When run with `--debug`.
Hence, it's not useful for us to define different G_LOG_DOMAIN per
library/application, because none of our libraries/applications should
use glib logging.
It also gets slightly confusing, because we have the static library like
`src/libnm-core-impl`, which is both linked into `libnm` (the library)
and `NetworkManager` (the daemon). Which logging domain should they use?
Set the G_LOG_DOMAIN to "nm" everywhere. But no longer do it via `-D`
arguments to the compiler.
See-also: https://developer.gnome.org/glib/stable/glib-Message-Logging.html#G-LOG-DOMAIN:CAPS
Diffstat (limited to 'shared')
-rw-r--r-- | shared/meson.build | 24 | ||||
-rw-r--r-- | shared/nm-glib-aux/tests/meson.build | 6 | ||||
-rw-r--r-- | shared/nm-platform/tests/meson.build | 3 | ||||
-rw-r--r-- | shared/nm-std-aux/nm-default-std.h | 4 | ||||
-rw-r--r-- | shared/nm-utils/nm-test-utils.h | 2 |
5 files changed, 2 insertions, 37 deletions
diff --git a/shared/meson.build b/shared/meson.build index a51497000e..6d680beb1a 100644 --- a/shared/meson.build +++ b/shared/meson.build @@ -105,9 +105,6 @@ libnm_std_aux = static_library( 'nm-std-aux/nm-std-utils.c', ], include_directories: top_inc, - c_args: [ - '-DG_LOG_DOMAIN="libnm"', - ], ) libnm_glib_aux = static_library( @@ -129,9 +126,6 @@ libnm_glib_aux = static_library( 'nm-glib-aux/nm-time-utils.c', ), dependencies: glib_nm_default_dep, - c_args: [ - '-DG_LOG_DOMAIN="libnm"', - ], link_with: [ libc_siphash, libnm_std_aux, @@ -160,9 +154,6 @@ libnm_udev_aux = static_library( glib_nm_default_dep, libudev_dep, ], - c_args: [ - '-DG_LOG_DOMAIN="libnm"', - ], ) libnm_udev_aux_dep = declare_dependency( @@ -176,9 +167,6 @@ libnm_base = static_library( 'nm-base/nm-ethtool-base.c', ), dependencies: libnm_glib_aux_dep_link, - c_args: [ - '-DG_LOG_DOMAIN="libnm"', - ], ) libnm_base_dep = declare_dependency( @@ -198,9 +186,6 @@ libnm_log_core = static_library( glib_nm_default_dep, libsystemd_dep, ], - c_args: [ - '-DG_LOG_DOMAIN="NetworkManager"', - ], ) libnm_log_core_dep = declare_dependency( @@ -221,9 +206,6 @@ libnm_platform = static_library( dependencies: [ glib_nm_default_dep, ], - c_args: [ - '-DG_LOG_DOMAIN="NetworkManager"', - ], ) libnm_platform_dep = declare_dependency( @@ -282,9 +264,6 @@ libnm_systemd_shared = static_library( 'systemd/src/shared', ), dependencies: glib_nm_default_dep, - c_args: [ - '-DG_LOG_DOMAIN="libnm"', - ], ) libnm_systemd_shared_dep = declare_dependency( @@ -301,9 +280,6 @@ libnm_systemd_logging_stub = static_library( 'nm-systemd-logging-stub', sources: 'systemd/nm-logging-stub.c', dependencies: glib_nm_default_dep, - c_args: [ - '-DG_LOG_DOMAIN="libnm"', - ], ) if enable_tests diff --git a/shared/nm-glib-aux/tests/meson.build b/shared/nm-glib-aux/tests/meson.build index a28d3b0802..1ee3380e31 100644 --- a/shared/nm-glib-aux/tests/meson.build +++ b/shared/nm-glib-aux/tests/meson.build @@ -3,9 +3,6 @@ exe = executable( 'test-shared-general', 'test-shared-general.c', - c_args: [ - '-DG_LOG_DOMAIN="test"', - ], dependencies: libnm_glib_aux_dep_link, link_with: libnm_systemd_logging_stub, ) @@ -21,9 +18,6 @@ if jansson_dep.found() exe = executable( 'test-json-aux', 'test-json-aux.c', - c_args: [ - '-DG_LOG_DOMAIN="test"', - ], dependencies: [ libnm_glib_aux_dep_link, jansson_dep, diff --git a/shared/nm-platform/tests/meson.build b/shared/nm-platform/tests/meson.build index a8fcdbca8e..dd9c3f58ee 100644 --- a/shared/nm-platform/tests/meson.build +++ b/shared/nm-platform/tests/meson.build @@ -3,9 +3,6 @@ exe = executable( 'test-nm-platform', 'test-nm-platform.c', - c_args: [ - '-DG_LOG_DOMAIN="test"', - ], dependencies: [ libnm_log_core_dep, libnm_platform_dep, diff --git a/shared/nm-std-aux/nm-default-std.h b/shared/nm-std-aux/nm-default-std.h index fe16d35fe2..0bd0eaa0c2 100644 --- a/shared/nm-std-aux/nm-default-std.h +++ b/shared/nm-std-aux/nm-default-std.h @@ -12,9 +12,7 @@ #error Dont define NETWORKMANAGER_COMPILATION #endif -#ifndef G_LOG_DOMAIN - #error Define G_LOG_DOMAIN -#endif +#define G_LOG_DOMAIN "nm" /*****************************************************************************/ diff --git a/shared/nm-utils/nm-test-utils.h b/shared/nm-utils/nm-test-utils.h index d51f972ed4..cf884f9c41 100644 --- a/shared/nm-utils/nm-test-utils.h +++ b/shared/nm-utils/nm-test-utils.h @@ -733,7 +733,7 @@ nmtst_test_quick(void) #define NMTST_EXPECT(domain, level, msg) g_test_expect_message(domain, level, msg) -#define NMTST_EXPECT_LIBNM(level, msg) NMTST_EXPECT("libnm", level, msg) +#define NMTST_EXPECT_LIBNM(level, msg) NMTST_EXPECT("nm", level, msg) #define NMTST_EXPECT_LIBNM_WARNING(msg) NMTST_EXPECT_LIBNM(G_LOG_LEVEL_WARNING, msg) #define NMTST_EXPECT_LIBNM_CRITICAL(msg) NMTST_EXPECT_LIBNM(G_LOG_LEVEL_CRITICAL, msg) |