repmgrd: add command line option -L/--log-level

Mainly for ad-hoc debugging purposes without needing to change
the configuration file.
This commit is contained in:
Ian Barwick
2017-06-22 00:09:18 +09:00
parent 8d84732026
commit d77736329a
5 changed files with 83 additions and 41 deletions

View File

@@ -22,7 +22,7 @@ static void tablespace_list_append(t_configuration_options *options, const char
static char *trim(char *s);
static void exit_with_errors(ItemList *config_errors, ItemList *config_warnings, bool terse);
static void exit_with_config_file_errors(ItemList *config_errors, ItemList *config_warnings, bool terse);
void
@@ -172,7 +172,7 @@ parse_config(t_configuration_options *options, bool terse)
/* errors found - exit after printing details, and any warnings */
if (config_errors.head != NULL)
{
exit_with_errors(&config_errors, &config_warnings, terse);
exit_with_config_file_errors(&config_errors, &config_warnings, terse);
}
if (terse == false && config_warnings.head != NULL)
@@ -649,7 +649,7 @@ reload_config(t_configuration_options *orig_options)
/* TODO: don't emit warnings if --terse and no errors */
static void
exit_with_errors(ItemList *config_errors, ItemList *config_warnings, bool terse)
exit_with_config_file_errors(ItemList *config_errors, ItemList *config_warnings, bool terse)
{
ItemListCell *cell;
@@ -675,6 +675,30 @@ exit_with_errors(ItemList *config_errors, ItemList *config_warnings, bool terse)
}
void
exit_with_cli_errors(ItemList *error_list)
{
fprintf(stderr, _("The following command line errors were encountered:\n"));
print_item_list(error_list);
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname());
exit(ERR_BAD_CONFIG);
}
void
print_item_list(ItemList *item_list)
{
ItemListCell *cell;
for (cell = item_list->head; cell; cell = cell->next)
{
fprintf(stderr, " %s\n", cell->string);
}
}
/*