*** pgsql/src/backend/utils/misc/guc.c 2008/04/02 14:42:56 1.441 --- pgsql/src/backend/utils/misc/guc.c 2008/04/03 09:21:15 1.442 *************** *** 10,16 **** * Written by Peter Eisentraut . * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.440 2008/03/25 22:42:45 tgl Exp $ * *-------------------------------------------------------------------- */ --- 10,16 ---- * Written by Peter Eisentraut . * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.441 2008/04/02 14:42:56 mha Exp $ * *-------------------------------------------------------------------- */ *************** static const char *assign_log_destinatio *** 135,142 **** #ifdef HAVE_SYSLOG static int syslog_facility = LOG_LOCAL0; ! static const char *assign_syslog_facility(const char *facility, ! bool doit, GucSource source); static const char *assign_syslog_ident(const char *ident, bool doit, GucSource source); #endif --- 135,142 ---- #ifdef HAVE_SYSLOG static int syslog_facility = LOG_LOCAL0; ! static bool assign_syslog_facility(int newval, ! bool doit, GucSource source); static const char *assign_syslog_ident(const char *ident, bool doit, GucSource source); #endif *************** static const struct config_enum_entry se *** 229,234 **** --- 229,246 ---- {NULL, 0} }; + static const struct config_enum_entry syslog_facility_options[] = { + {"local0", LOG_LOCAL0}, + {"local1", LOG_LOCAL1}, + {"local2", LOG_LOCAL2}, + {"local3", LOG_LOCAL3}, + {"local4", LOG_LOCAL4}, + {"local5", LOG_LOCAL5}, + {"local6", LOG_LOCAL6}, + {"local7", LOG_LOCAL7}, + {NULL, 0} + }; + /* * GUC option variables that are exported from this module *************** int tcp_keepalives_count; *** 283,289 **** static char *log_destination_string; #ifdef HAVE_SYSLOG - static char *syslog_facility_str; static char *syslog_ident_str; #endif static bool phony_autocommit; --- 295,300 ---- *************** static struct config_string ConfigureNam *** 2232,2246 **** #ifdef HAVE_SYSLOG { - {"syslog_facility", PGC_SIGHUP, LOGGING_WHERE, - gettext_noop("Sets the syslog \"facility\" to be used when syslog enabled."), - gettext_noop("Valid values are LOCAL0, LOCAL1, LOCAL2, LOCAL3, " - "LOCAL4, LOCAL5, LOCAL6, LOCAL7.") - }, - &syslog_facility_str, - "LOCAL0", assign_syslog_facility, NULL - }, - { {"syslog_ident", PGC_SIGHUP, LOGGING_WHERE, gettext_noop("Sets the program name used to identify PostgreSQL " "messages in syslog."), --- 2243,2248 ---- *************** static struct config_enum ConfigureNames *** 2488,2493 **** --- 2490,2507 ---- LOGSTMT_NONE, log_statement_options, NULL, NULL }, + #ifdef HAVE_SYSLOG + { + {"syslog_facility", PGC_SIGHUP, LOGGING_WHERE, + gettext_noop("Sets the syslog \"facility\" to be used when syslog enabled."), + gettext_noop("Valid values are LOCAL0, LOCAL1, LOCAL2, LOCAL3, " + "LOCAL4, LOCAL5, LOCAL6, LOCAL7.") + }, + &syslog_facility, + LOG_LOCAL0, syslog_facility_options, assign_syslog_facility, NULL + }, + #endif + { {"regex_flavor", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS, gettext_noop("Sets the regular expression \"flavor\"."), *************** assign_log_destination(const char *value *** 6860,6897 **** #ifdef HAVE_SYSLOG ! static const char * ! assign_syslog_facility(const char *facility, bool doit, GucSource source) { - int syslog_fac; - - if (pg_strcasecmp(facility, "LOCAL0") == 0) - syslog_fac = LOG_LOCAL0; - else if (pg_strcasecmp(facility, "LOCAL1") == 0) - syslog_fac = LOG_LOCAL1; - else if (pg_strcasecmp(facility, "LOCAL2") == 0) - syslog_fac = LOG_LOCAL2; - else if (pg_strcasecmp(facility, "LOCAL3") == 0) - syslog_fac = LOG_LOCAL3; - else if (pg_strcasecmp(facility, "LOCAL4") == 0) - syslog_fac = LOG_LOCAL4; - else if (pg_strcasecmp(facility, "LOCAL5") == 0) - syslog_fac = LOG_LOCAL5; - else if (pg_strcasecmp(facility, "LOCAL6") == 0) - syslog_fac = LOG_LOCAL6; - else if (pg_strcasecmp(facility, "LOCAL7") == 0) - syslog_fac = LOG_LOCAL7; - else - return NULL; /* reject */ - if (doit) - { - syslog_facility = syslog_fac; set_syslog_parameters(syslog_ident_str ? syslog_ident_str : "postgres", ! syslog_facility); ! } ! return facility; } static const char * --- 6874,6887 ---- #ifdef HAVE_SYSLOG ! static bool ! assign_syslog_facility(int newval, bool doit, GucSource source) { if (doit) set_syslog_parameters(syslog_ident_str ? syslog_ident_str : "postgres", ! newval); ! return true; } static const char *