GitLab will be down for maintenance this Sunday 13th June, from approx 7-11am UTC. This is for a PostgreSQL migration. See the tracker issue for more informations.

Commit 4439b6a3 authored by Thomas Haller's avatar Thomas Haller
Browse files

main: warn about invalid logging domains configuration using nm-log

Delay warning about invalid domains until we setup syslog and nm-logging.
Preferably, we don't log anything by directly printing to stdout/stderr.
parent 11303fd2
...@@ -305,11 +305,6 @@ main (int argc, char *argv[]) ...@@ -305,11 +305,6 @@ main (int argc, char *argv[])
_("%s. Please use --help to see a list of valid options.\n"), _("%s. Please use --help to see a list of valid options.\n"),
error->message); error->message);
exit (1); exit (1);
} else if (bad_domains) {
fprintf (stderr,
_("Ignoring unrecognized log domain(s) '%s' passed on command line.\n"),
bad_domains);
g_clear_pointer (&bad_domains, g_free);
} }
/* Read the config file and CLI overrides */ /* Read the config file and CLI overrides */
...@@ -332,12 +327,8 @@ main (int argc, char *argv[]) ...@@ -332,12 +327,8 @@ main (int argc, char *argv[])
nm_config_get_log_domains (config), nm_config_get_log_domains (config),
&bad_domains, &bad_domains,
&error_invalid_logging_config)) { &error_invalid_logging_config)) {
/* ignore error, and print the failure reason below. */ /* ignore error, and print the failure reason below.
} else if (bad_domains) { * Likewise, print about bad_domains below. */
fprintf (stderr,
_("Ignoring unrecognized log domain(s) '%s' from config files.\n"),
bad_domains);
g_clear_pointer (&bad_domains, g_free);
} }
} }
...@@ -377,6 +368,14 @@ main (int argc, char *argv[]) ...@@ -377,6 +368,14 @@ main (int argc, char *argv[])
nm_log_warn (LOGD_CORE, "config: invalid logging configuration: %s", error_invalid_logging_config->message); nm_log_warn (LOGD_CORE, "config: invalid logging configuration: %s", error_invalid_logging_config->message);
g_clear_error (&error_invalid_logging_config); g_clear_error (&error_invalid_logging_config);
} }
if (bad_domains) {
nm_log_warn (LOGD_CORE, "config: invalid logging domains '%s' from %s",
bad_domains,
(global_opt.opt_log_level == NULL && global_opt.opt_log_domains == NULL)
? "config file"
: "command line");
nm_clear_g_free (&bad_domains);
}
/* the first access to State causes the file to be read (and possibly print a warning) */ /* the first access to State causes the file to be read (and possibly print a warning) */
nm_config_state_get (config); nm_config_state_get (config);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment