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 <thaller@redhat.com>
This commit is contained in:
Thomas Haller 2014-07-09 14:41:07 +02:00
parent a218199eb6
commit 98bc1c8cf9

View file

@ -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);