From 98bc1c8cf9a64ac8b32bd68d8431b48892cccfee Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 9 Jul 2014 14:41:07 +0200 Subject: [PATCH] config: replace g_warning() by nm_log_warn() Quite possibly these logging lines hit before we setup nm-logging initially and before NM main() calls nm_logging_syslog_openlog(). This is because NM first needs to read the configuration, before setting up logging. Note however, that nm-logging is robust against both. If nm_logging_setup() was not yet called, it will automatically setup "DEFAULT","INFO". If nm_logging_syslog_openlog() was not yet called, it will redirect logging to g_log() -- which basically ends up at g_warning() again. Still this is useful in case when hitting those lines *afterwards*. Especially, later when we support reloading of configuration. Signed-off-by: Thomas Haller --- src/config/nm-config.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/config/nm-config.c b/src/config/nm-config.c index 104d83acef..32874f649d 100644 --- a/src/config/nm-config.c +++ b/src/config/nm-config.c @@ -384,9 +384,9 @@ find_base_config (NMConfig *config, GError **error) } if (!g_error_matches (my_error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)) { - g_warning ("Default config file %s invalid: %s\n", - NM_OLD_SYSTEM_CONF_FILE, - my_error->message); + nm_log_warn (LOGD_CORE, "Old default config file %s invalid: %s\n", + NM_OLD_SYSTEM_CONF_FILE, + my_error->message); } g_clear_error (&my_error); @@ -397,9 +397,9 @@ find_base_config (NMConfig *config, GError **error) } if (!g_error_matches (my_error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)) { - g_warning ("Default config file %s invalid: %s\n", - NM_DEFAULT_SYSTEM_CONF_FILE, - my_error->message); + nm_log_warn (LOGD_CORE, "Default config file %s invalid: %s\n", + NM_DEFAULT_SYSTEM_CONF_FILE, + my_error->message); g_propagate_error (error, my_error); return FALSE; } @@ -409,8 +409,8 @@ find_base_config (NMConfig *config, GError **error) * config file path. */ priv->nm_conf_path = g_strdup (NM_DEFAULT_SYSTEM_CONF_FILE); - g_warning ("No config file found or given; using %s\n", - NM_DEFAULT_SYSTEM_CONF_FILE); + nm_log_info (LOGD_CORE, "No config file found or given; using %s\n", + NM_DEFAULT_SYSTEM_CONF_FILE); return TRUE; } @@ -517,7 +517,7 @@ nm_config_new (GError **error) else if (!strcmp (value, "false") || !strcmp (value, "no") || !strcmp (value, "off")) priv->monitor_connection_files = FALSE; else { - g_warning ("Unrecognized value for main.monitor-connection-files: %s. Assuming 'false'", value); + nm_log_warn (LOGD_CORE, "Unrecognized value for main.monitor-connection-files: %s. Assuming 'false'", value); priv->monitor_connection_files = FALSE; } g_free (value);