1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Ok, You guys are probably tired of me, BUT, here is another one, that

adds the facility to set the program name used in syslog.
(this includes the other ones).

One gotcha, the parser doesn't like special characters in strings.
For example, i tried to use pg-test, and if failed the parse coming
from the postgresql.conf file.

I don't think it's a showstopper..

Larry Rosenman
This commit is contained in:
Bruce Momjian
2000-11-13 21:35:03 +00:00
parent b557be50a0
commit d63a762f79
3 changed files with 73 additions and 4 deletions

View File

@ -4,7 +4,7 @@
* Support for grand unified configuration scheme, including SET
* command, configuration file, and command line options.
*
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.17 2000/11/13 15:18:12 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.18 2000/11/13 21:35:03 momjian Exp $
*
* Copyright 2000 by PostgreSQL Global Development Group
* Written by Peter Eisentraut <peter_e@gmx.net>.
@ -39,6 +39,11 @@ extern bool Log_connections;
extern int CheckPointTimeout;
extern int XLOGbuffers;
extern int XLOG_DEBUG;
#ifdef ENABLE_SYSLOG
extern char *Syslog_facility;
extern char *Syslog_progid;
bool check_facility(const char *facility);
#endif
/*
* Debugging options
@ -303,6 +308,12 @@ ConfigureNamesString[] =
{"unix_socket_group", PGC_POSTMASTER, &Unix_socket_group,
"", NULL},
#ifdef ENABLE_SYSLOG
{"syslog_facility", PGC_SIGHUP, &Syslog_facility,
"LOCAL0", check_facility},
{"syslog_progid", PGC_SIGHUP, &Syslog_progid,
"postgres", NULL},
#endif
{"unixsocket", PGC_POSTMASTER, &UnixSocketName,
"", NULL},
@ -813,3 +824,18 @@ ParseLongOption(const char * string, char ** name, char ** value)
if (*cp == '-')
*cp = '_';
}
#ifdef ENABLE_SYSLOG
bool
check_facility(const char *facility)
{
if (strcasecmp(facility,"LOCAL0") == 0) return true;
if (strcasecmp(facility,"LOCAL1") == 0) return true;
if (strcasecmp(facility,"LOCAL2") == 0) return true;
if (strcasecmp(facility,"LOCAL3") == 0) return true;
if (strcasecmp(facility,"LOCAL4") == 0) return true;
if (strcasecmp(facility,"LOCAL5") == 0) return true;
if (strcasecmp(facility,"LOCAL6") == 0) return true;
if (strcasecmp(facility,"LOCAL7") == 0) return true;
return false;
}
#endif