mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-12 03:20:20 +01:00
config: drop nm_config_get_debug() and access config directly
This commit is contained in:
parent
61c6ccaad4
commit
c7d2e1f3bc
3 changed files with 10 additions and 17 deletions
10
src/main.c
10
src/main.c
|
|
@ -85,7 +85,7 @@ _set_g_fatal_warnings (void)
|
|||
}
|
||||
|
||||
static void
|
||||
_init_nm_debug (const char *debug)
|
||||
_init_nm_debug (NMConfig *config)
|
||||
{
|
||||
const guint D_RLIMIT_CORE = 1;
|
||||
const guint D_FATAL_WARNINGS = 2;
|
||||
|
|
@ -95,6 +95,12 @@ _init_nm_debug (const char *debug)
|
|||
};
|
||||
guint flags;
|
||||
const char *env = getenv ("NM_DEBUG");
|
||||
gs_free char *debug;
|
||||
|
||||
debug = nm_config_data_get_value (nm_config_get_data_orig (config),
|
||||
NM_CONFIG_KEYFILE_GROUP_MAIN,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_DEBUG,
|
||||
NM_MANAGER_RELOAD_FLAGS_NONE);
|
||||
|
||||
flags = nm_utils_parse_debug_string (env, keys, G_N_ELEMENTS (keys));
|
||||
flags |= nm_utils_parse_debug_string (debug, keys, G_N_ELEMENTS (keys));
|
||||
|
|
@ -302,7 +308,7 @@ main (int argc, char *argv[])
|
|||
exit (1);
|
||||
}
|
||||
|
||||
_init_nm_debug (nm_config_get_debug (config));
|
||||
_init_nm_debug (config);
|
||||
|
||||
/* Initialize logging from config file *only* if not explicitly
|
||||
* specified by commandline.
|
||||
|
|
|
|||
|
|
@ -96,8 +96,6 @@ typedef struct {
|
|||
char *log_level;
|
||||
char *log_domains;
|
||||
|
||||
char *debug;
|
||||
|
||||
gboolean configure_and_quit;
|
||||
|
||||
char **atomic_section_prefixes;
|
||||
|
|
@ -281,14 +279,6 @@ nm_config_get_log_domains (NMConfig *config)
|
|||
return NM_CONFIG_GET_PRIVATE (config)->log_domains;
|
||||
}
|
||||
|
||||
const char *
|
||||
nm_config_get_debug (NMConfig *config)
|
||||
{
|
||||
g_return_val_if_fail (config != NULL, NULL);
|
||||
|
||||
return NM_CONFIG_GET_PRIVATE (config)->debug;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_config_get_configure_and_quit (NMConfig *config)
|
||||
{
|
||||
|
|
@ -625,7 +615,7 @@ static gboolean
|
|||
_setting_is_string_list (const char *group, const char *key)
|
||||
{
|
||||
return _IS (NM_CONFIG_KEYFILE_GROUP_MAIN, "plugins")
|
||||
|| _IS (NM_CONFIG_KEYFILE_GROUP_MAIN, "debug")
|
||||
|| _IS (NM_CONFIG_KEYFILE_GROUP_MAIN, NM_CONFIG_KEYFILE_KEY_MAIN_DEBUG)
|
||||
|| _IS (NM_CONFIG_KEYFILE_GROUP_LOGGING, "domains")
|
||||
|| g_str_has_prefix (group, NM_CONFIG_KEYFILE_GROUPPREFIX_TEST_APPEND_STRINGLIST);
|
||||
#undef _IS
|
||||
|
|
@ -2316,8 +2306,6 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
|
|||
priv->log_level = nm_strstrip (g_key_file_get_string (keyfile, NM_CONFIG_KEYFILE_GROUP_LOGGING, "level", NULL));
|
||||
priv->log_domains = nm_strstrip (g_key_file_get_string (keyfile, NM_CONFIG_KEYFILE_GROUP_LOGGING, "domains", NULL));
|
||||
|
||||
priv->debug = g_key_file_get_string (keyfile, NM_CONFIG_KEYFILE_GROUP_MAIN, "debug", NULL);
|
||||
|
||||
priv->configure_and_quit = nm_config_keyfile_get_boolean (keyfile, NM_CONFIG_KEYFILE_GROUP_MAIN, "configure-and-quit", FALSE);
|
||||
|
||||
no_auto_default = no_auto_default_from_file (priv->no_auto_default_file);
|
||||
|
|
@ -2374,7 +2362,6 @@ finalize (GObject *gobject)
|
|||
g_free (priv->intern_config_file);
|
||||
g_free (priv->log_level);
|
||||
g_free (priv->log_domains);
|
||||
g_free (priv->debug);
|
||||
g_strfreev (priv->atomic_section_prefixes);
|
||||
|
||||
_nm_config_cmd_line_options_clear (&priv->cli);
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@
|
|||
|
||||
#define NM_CONFIG_KEYFILE_KEY_MAIN_AUTH_POLKIT "auth-polkit"
|
||||
#define NM_CONFIG_KEYFILE_KEY_MAIN_DHCP "dhcp"
|
||||
#define NM_CONFIG_KEYFILE_KEY_MAIN_DEBUG "debug"
|
||||
#define NM_CONFIG_KEYFILE_KEY_LOGGING_BACKEND "backend"
|
||||
#define NM_CONFIG_KEYFILE_KEY_CONFIG_ENABLE "enable"
|
||||
#define NM_CONFIG_KEYFILE_KEY_ATOMIC_SECTION_WAS ".was"
|
||||
|
|
@ -119,7 +120,6 @@ NMConfigData *nm_config_get_data_orig (NMConfig *config);
|
|||
gboolean nm_config_get_monitor_connection_files (NMConfig *config);
|
||||
const char *nm_config_get_log_level (NMConfig *config);
|
||||
const char *nm_config_get_log_domains (NMConfig *config);
|
||||
const char *nm_config_get_debug (NMConfig *config);
|
||||
gboolean nm_config_get_configure_and_quit (NMConfig *config);
|
||||
gboolean nm_config_get_is_debug (NMConfig *config);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue