Convert printed "WARNING" messages to logging output

In a couple of places ("cluster show" and "service status") we printed
connection status errors as a "WARNING" to stdout, followed by a log
HINT, but the latter was ineffective unless the configured log
level happened to match the level of the most recently emitted log
line (which will most likely be DEBUG).

Convert the printed WARNING lines to an actual log WARNING, to make the
behaviour of this output behave as expected.
This commit is contained in:
Ian Barwick
2020-02-25 15:25:59 +09:00
parent 51a7c31833
commit cebb1249aa
2 changed files with 27 additions and 5 deletions

View File

@@ -357,11 +357,22 @@ do_service_status(void)
{
ItemListCell *cell = NULL;
printf(_("\nWARNING: following issues were detected\n"));
PQExpBufferData warning;
initPQExpBuffer(&warning);
appendPQExpBufferStr(&warning,
_("following issues were detected\n"));
for (cell = warnings.head; cell; cell = cell->next)
{
printf(_(" - %s\n"), cell->string);
appendPQExpBuffer(&warning,
_(" - %s\n"), cell->string);
}
puts("");
log_warning("%s", warning.data);
termPQExpBuffer(&warning);
if (runtime_options.verbose == false && connection_error_found == true)
{