20#if !defined(LOG_AUTHPRIV) && defined(LOG_AUTH)
21#define LOG_AUTHPRIV LOG_AUTH
30syslog_ntoa(
const char *s)
32#define syslog_symbol(a) #a, a
33 static syslog_symbol_t symbols[] = {
35 {syslog_symbol(LOG_AUTHPRIV)},
38 {syslog_symbol(LOG_DAEMON)},
41 {syslog_symbol(LOG_LOCAL0)},
44 {syslog_symbol(LOG_LOCAL1)},
47 {syslog_symbol(LOG_LOCAL2)},
50 {syslog_symbol(LOG_LOCAL3)},
53 {syslog_symbol(LOG_LOCAL4)},
56 {syslog_symbol(LOG_LOCAL5)},
59 {syslog_symbol(LOG_LOCAL6)},
62 {syslog_symbol(LOG_LOCAL7)},
65 {syslog_symbol(LOG_USER)},
68 {syslog_symbol(LOG_ERR)},
71 {syslog_symbol(LOG_WARNING)},
74 {syslog_symbol(LOG_NOTICE)},
77 {syslog_symbol(LOG_INFO)},
80 {syslog_symbol(LOG_DEBUG)},
86 for (p = symbols; p->name !=
nullptr; ++p)
87 if (!strcmp(s, p->name) || !strcasecmp(s, p->name + 4))
98#define PRIORITY_MASK (LOG_ERR | LOG_WARNING | LOG_NOTICE | LOG_INFO | LOG_DEBUG)
101logfile_mod_syslog_writeline(
Logfile * lf,
const char *buf,
size_t)
103 l_syslog_t *ll = (l_syslog_t *) lf->
data;
104 syslog(ll->syslog_priority,
"%s", (
char *) buf);
108logfile_mod_syslog_linestart(
Logfile *)
113logfile_mod_syslog_lineend(
Logfile *)
118logfile_mod_syslog_flush(
Logfile *)
123logfile_mod_syslog_rotate(
Logfile *,
const int16_t)
128logfile_mod_syslog_close(
Logfile *lf)
140 lf->
f_close = logfile_mod_syslog_close;
143 lf->
f_lineend = logfile_mod_syslog_lineend;
144 lf->
f_flush = logfile_mod_syslog_flush;
145 lf->
f_rotate = logfile_mod_syslog_rotate;
147 l_syslog_t *ll =
static_cast<l_syslog_t*
>(
xcalloc(1,
sizeof(*ll)));
150 ll->syslog_priority = LOG_INFO;
152 if (path[6] !=
'\0') {
153 char *priority =
xstrdup(path);
154 char *facility = (
char *) strchr(priority,
'.');
156 facility = (
char *) strchr(priority,
'|');
160 ll->syslog_priority |= syslog_ntoa(facility);
162 ll->syslog_priority |= syslog_ntoa(priority);
164 if ((ll->syslog_priority & PRIORITY_MASK) == 0)
165 ll->syslog_priority |= LOG_INFO;
int logfile_mod_syslog_open(Logfile *lf, const char *path, size_t bufsz, int fatal_flag)
LOGLINESTART * f_linestart
#define debugs(SECTION, LEVEL, CONTENT)
void * xcalloc(size_t n, size_t sz)