Standardize quoting in log messages

This commit is contained in:
Ian Barwick
2017-09-21 14:05:51 +09:00
parent dd06ed2b92
commit d6c27f8938
9 changed files with 28 additions and 30 deletions

View File

@@ -1370,7 +1370,7 @@ parse_bool(const char *s, const char *config_item, ItemList *error_list)
initPQExpBuffer(&errors);
appendPQExpBuffer(&errors,
"\"%s\": unable to interpret '%s' as a boolean value",
"\"%s\": unable to interpret \"%s\" as a boolean value",
config_item, s);
item_list_append(error_list, errors.data);
termPQExpBuffer(&errors);

View File

@@ -3161,7 +3161,7 @@ create_replication_slot(PGconn *conn, char *slot_name, int server_version_num, P
slot_name);
}
log_debug(_("create_replication_slot(): creating slot '%s' on upstream"), slot_name);
log_debug(_("create_replication_slot(): creating slot \"%s\" on upstream"), slot_name);
log_verbose(LOG_DEBUG, "create_replication_slot():\n%s", query.data);
res = PQexec(conn, query.data);

4
log.c
View File

@@ -263,14 +263,14 @@ logger_init(t_configuration_options *opts, const char *ident)
fd = fopen(opts->log_file, "a");
if (fd == NULL)
{
stderr_log_error(_("unable to open specified log file '%s' for writing: %s\n"),
stderr_log_error(_("unable to open specified log file \"%s\" for writing: %s\n"),
opts->log_file, strerror(errno));
stderr_log_error(_("Terminating\n"));
exit(ERR_BAD_CONFIG);
}
fclose(fd);
stderr_log_notice(_("redirecting logging output to '%s'\n"), opts->log_file);
stderr_log_notice(_("redirecting logging output to \"%s\"\n"), opts->log_file);
fd = freopen(opts->log_file, "a", stderr);
/*

View File

@@ -277,9 +277,9 @@ do_bdr_register(void)
if (strncmp(node_info.node_name, config_file_options.node_name, MAXLEN) != 0)
{
log_error(_("a record for node %i is already registered with node_name '%s'"),
log_error(_("a record for node %i is already registered with node_name \"%s\""),
config_file_options.node_id, node_info.node_name);
log_hint(_("node_name configured in repmgr.conf is '%s'"), config_file_options.node_name);
log_hint(_("node_name configured in repmgr.conf is \"%s\""), config_file_options.node_name);
rollback_transaction(conn);
PQfinish(conn);
@@ -290,7 +290,7 @@ do_bdr_register(void)
if (node_updated == true)
{
appendPQExpBuffer(&event_details, _("node record updated for node '%s' (%i)"),
appendPQExpBuffer(&event_details, _("node record updated for node \"%s\" (%i)"),
config_file_options.node_name, config_file_options.node_id);
log_verbose(LOG_NOTICE, "%s", event_details.data);
}
@@ -308,7 +308,7 @@ do_bdr_register(void)
if (node_created == true)
{
appendPQExpBuffer(&event_details,
_("node record created for node '%s' (ID: %i)"),
_("node record created for node \"%s\" (ID: %i)"),
config_file_options.node_name, config_file_options.node_id);
log_notice("%s", event_details.data);
}

View File

@@ -642,7 +642,7 @@ do_standby_clone(void)
/* Add details about relevant runtime options used */
appendPQExpBuffer(&event_details,
_("cloned from host '%s', port %s"),
_("cloned from host \"%s\", port %s"),
runtime_options.host,
runtime_options.port);
@@ -2271,8 +2271,6 @@ do_standby_switchover(void)
if (command_success == true)
{
status = parse_node_check_archiver(command_output.data, &files, &threshold);
log_debug("%i %i; '%s'", files, threshold, command_output.data);
}
termPQExpBuffer(&command_output);
@@ -2773,7 +2771,7 @@ do_standby_switchover(void)
termPQExpBuffer(&node_rejoin_options);
log_debug("executing:\n \"%s\"", remote_command_str.data);
log_debug("executing:\n %s", remote_command_str.data);
initPQExpBuffer(&command_output);
command_success = remote_command(
@@ -2873,7 +2871,7 @@ do_standby_switchover(void)
appendPQExpBuffer(&remote_command_str,
"standby follow 2>/dev/null && echo \"1\" || echo \"0\"");
get_conninfo_value(cell->node_info->conninfo, "host", host);
log_debug("executing:\n \"%s\"", remote_command_str.data);
log_debug("executing:\n %s", remote_command_str.data);
initPQExpBuffer(&command_output);
@@ -3251,9 +3249,9 @@ check_upstream_config(PGconn *conn, int server_version_num, t_node_info *node_in
{
if (exit_on_error == true)
{
log_error(_("error(s) encountered parsing 'pg_basebackup_options'"));
log_error(_("error(s) encountered parsing \"pg_basebackup_options\""));
print_error_list(&backup_option_errors, LOG_ERR);
log_hint(_("'pg_basebackup_options' is: '%s'"),
log_hint(_("\"pg_basebackup_options\" is: \"%s\""),
config_file_options.pg_basebackup_options);
exit(ERR_BAD_CONFIG);
}
@@ -3893,7 +3891,7 @@ run_basebackup(t_node_info *node_record)
termPQExpBuffer(&params);
log_info(_("executing: '%s'"), script);
log_info(_("executing:\n %s"), script);
/*
* As of 9.4, pg_basebackup only ever returns 0 or 1
@@ -4320,7 +4318,7 @@ run_file_backup(t_node_info *node_record)
if (mapping_found == true)
{
tblspc_dir_dest = cell->new_dir;
log_debug(_("mapping source tablespace '%s' (OID %s) to '%s'"),
log_debug(_("mapping source tablespace \"%s\" (OID %s) to \"%s\""),
cell_t->location, cell_t->oid, tblspc_dir_dest);
}
else
@@ -4445,7 +4443,7 @@ run_file_backup(t_node_info *node_record)
tablespace_map_file = fopen(tablespace_map_filename.data, "w");
if (tablespace_map_file == NULL)
{
log_error(_("unable to create tablespace_map file '%s'"), tablespace_map_filename.data);
log_error(_("unable to create tablespace_map file \"%s\""), tablespace_map_filename.data);
r = ERR_BAD_BASEBACKUP;
goto stop_backup;
@@ -4453,7 +4451,7 @@ run_file_backup(t_node_info *node_record)
if (fputs(tablespace_map.data, tablespace_map_file) == EOF)
{
log_error(_("unable to write to tablespace_map file '%s'"), tablespace_map_filename.data);
log_error(_("unable to write to tablespace_map file \"%s\""), tablespace_map_filename.data);
r = ERR_BAD_BASEBACKUP;
goto stop_backup;

View File

@@ -2055,7 +2055,7 @@ test_ssh_connection(char *host, char *remote_user)
}
if (r != 0)
log_warning(_("unable to connect to remote host '%s' via SSH"), host);
log_warning(_("unable to connect to remote host \"%s\" via SSH"), host);
return r;
}
@@ -2281,7 +2281,7 @@ copy_remote_files(char *host, char *remote_user, char *remote_path,
termPQExpBuffer(&rsync_flags);
log_info(_("rsync command line: '%s'"), script);
log_info(_("rsync command line:\n %s"), script);
r = system(script);

View File

@@ -47,7 +47,7 @@ monitor_bdr(void)
instr_time log_status_interval_start;
/* sanity check local database */
log_info(_("connecting to local database '%s'"),
log_info(_("connecting to local database \"%s\""),
config_file_options.conninfo);
local_conn = establish_db_connection(config_file_options.conninfo, true);
@@ -314,7 +314,7 @@ loop:
fd = freopen(config_file_options.log_file, "a", stderr);
if (fd == NULL)
{
fprintf(stderr, "error reopening stderr to '%s': %s",
fprintf(stderr, "error reopening stderr to \"%s\": %s",
config_file_options.log_file, strerror(errno));
}
}
@@ -456,7 +456,7 @@ do_bdr_failover(NodeInfoList *nodes, t_node_info *monitored_node)
log_notice(_("setting node record for node %i to inactive"), monitored_node->node_id);
appendPQExpBuffer(&event_details,
_("node '%s' (ID: %i) detected as failed; next available node is '%s' (ID: %i)"),
_("node \"%s\" (ID: %i) detected as failed; next available node is \"%s\" (ID: %i)"),
monitored_node->node_name,
monitored_node->node_id,
target_node.node_name,

View File

@@ -391,7 +391,7 @@ loop:
fd = freopen(config_file_options.log_file, "a", stderr);
if (fd == NULL)
{
fprintf(stderr, "error reopening stderr to '%s': %s",
fprintf(stderr, "error reopening stderr to \"%s\": %s",
config_file_options.log_file, strerror(errno));
}
}
@@ -925,7 +925,7 @@ loop:
fd = freopen(config_file_options.log_file, "a", stderr);
if (fd == NULL)
{
fprintf(stderr, "error reopening stderr to '%s': %s",
fprintf(stderr, "error reopening stderr to \"%s\": %s",
config_file_options.log_file, strerror(errno));
}
}

View File

@@ -497,7 +497,7 @@ daemonize_process(void)
ret = chdir(path);
if (ret != 0)
{
log_error(_("error changing directory to '%s':\n %s"), path,
log_error(_("error changing directory to \"%s\":\n %s"), path,
strerror(errno));
}
@@ -525,7 +525,7 @@ check_and_create_pid_file(const char *pid_file)
if (fd == NULL)
{
log_error(_("PID file %s exists but could not opened for reading"), pid_file);
log_error(_("PID file \"%s\" exists but could not opened for reading"), pid_file);
log_hint(_("if repmgrd is no longer alive, remove the file and restart repmgrd"));
exit(ERR_BAD_PIDFILE);
}
@@ -534,7 +534,7 @@ check_and_create_pid_file(const char *pid_file)
if (nread == 0 && ferror(fd))
{
log_error(_("error reading PID file '%s', aborting"), pid_file);
log_error(_("error reading PID file \"%s\", aborting"), pid_file);
exit(ERR_BAD_PIDFILE);
}
@@ -546,7 +546,7 @@ check_and_create_pid_file(const char *pid_file)
{
if (kill(pid, 0) != -1)
{
log_error(_("PID file %s exists and seems to contain a valid PID"), pid_file);
log_error(_("PID file \"%s\" exists and seems to contain a valid PID"), pid_file);
log_hint(_("if repmgrd is no longer alive, remove the file and restart repmgrd"));
exit(ERR_BAD_PIDFILE);
}