Convert some remaining fprintf messages to logger

This commit is contained in:
Greg Smith
2011-06-07 00:50:46 -04:00
parent 06aecbf58a
commit 8200b68cf7
2 changed files with 8 additions and 8 deletions

View File

@@ -23,7 +23,7 @@
#include "repmgr.h" #include "repmgr.h"
void void
parse_config(const char* config_file, t_configuration_options* options) parse_config(const char *config_file, t_configuration_options *options)
{ {
char *s, buff[MAXLINELENGTH]; char *s, buff[MAXLINELENGTH];
char name[MAXLEN]; char name[MAXLEN];
@@ -43,7 +43,7 @@ parse_config(const char* config_file, t_configuration_options* options)
*/ */
if (fp == NULL) if (fp == NULL)
{ {
fprintf(stderr, _("Did not find the configuration file '%s', continuing\n"), config_file); log_err(_("Did not find the configuration file '%s', continuing\n"), config_file);
return; return;
} }
@@ -71,7 +71,7 @@ parse_config(const char* config_file, t_configuration_options* options)
else if (strcmp(name, "logfacility") == 0) else if (strcmp(name, "logfacility") == 0)
strncpy (options->logfacility, value, MAXLEN); strncpy (options->logfacility, value, MAXLEN);
else else
printf ("WARNING: %s/%s: Unknown name/value pair!\n", name, value); log_warning(_("%s/%s: Unknown name/value pair!\n"), name, value);
} }
/* Close file */ /* Close file */
@@ -80,19 +80,18 @@ parse_config(const char* config_file, t_configuration_options* options)
/* Check config settings */ /* Check config settings */
if (strnlen(options->cluster_name, MAXLEN)==0) if (strnlen(options->cluster_name, MAXLEN)==0)
{ {
fprintf(stderr, "Cluster name is missing. " log_err(_("Cluster name is missing. Check the configuration file.\n"));
"Check the configuration file.\n");
exit(ERR_BAD_CONFIG); exit(ERR_BAD_CONFIG);
} }
if (options->node == -1) if (options->node == -1)
{ {
fprintf(stderr, "Node information is missing. " log_err(_("Node information is missing. Check the configuration file.\n"));
"Check the configuration file.\n");
exit(ERR_BAD_CONFIG); exit(ERR_BAD_CONFIG);
} }
} }
char * char *
trim (char *s) trim (char *s)
{ {
@@ -145,3 +144,4 @@ parse_line(char *buff, char *name, char *value)
value[j] = '\0'; value[j] = '\0';
trim(value); trim(value);
} }

View File

@@ -33,7 +33,7 @@ typedef struct
char rsync_options[QUERY_STR_LEN]; char rsync_options[QUERY_STR_LEN];
} t_configuration_options; } t_configuration_options;
void parse_config(const char* config_file, t_configuration_options* options); void parse_config(const char *config_file, t_configuration_options *options);
void parse_line(char *buff, char *name, char *value); void parse_line(char *buff, char *name, char *value);
char *trim(char *s); char *trim(char *s);