mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Follow up on ed9c16ad5def47d1c8ae2787f53dccfac893ce5f
The event log is not line based, passing the message as is here is just fine. Otherwise we'd create multiple event log items with partial messages.
This commit is contained in:
@@ -37,6 +37,17 @@
|
||||
#define syslog std_syslog
|
||||
#endif
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
PHPAPI void php_syslog(int priority, const char *format, ...) /* {{{ */
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
vsyslog(priority, format, args);
|
||||
va_end(args);
|
||||
}
|
||||
/* }}} */
|
||||
#else
|
||||
PHPAPI void php_syslog(int priority, const char *format, ...) /* {{{ */
|
||||
{
|
||||
const char *ptr;
|
||||
@@ -68,8 +79,8 @@ PHPAPI void php_syslog(int priority, const char *format, ...) /* {{{ */
|
||||
smart_string_free(&fbuf);
|
||||
smart_string_free(&sbuf);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
extern void closelog(void);
|
||||
extern void openlog(const char *, int, int);
|
||||
extern void syslog(int, const char *, ...);
|
||||
extern void vsyslog(int, const char *, va_list ap);
|
||||
|
||||
|
||||
#endif /* SYSLOG_H */
|
||||
|
||||
@@ -80,6 +80,14 @@ void closelog(void)
|
||||
void syslog(int priority, const char *message, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, message); /* initialize vararg mechanism */
|
||||
vsyslog(priority, message, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void vsyslog(int priority, const char *message, va_list args)
|
||||
{
|
||||
LPTSTR strs[2];
|
||||
unsigned short etype;
|
||||
char *tmp = NULL;
|
||||
@@ -102,13 +110,11 @@ void syslog(int priority, const char *message, ...)
|
||||
etype = EVENTLOG_WARNING_TYPE;
|
||||
evid = PHP_SYSLOG_WARNING_TYPE;
|
||||
}
|
||||
va_start(args, message); /* initialize vararg mechanism */
|
||||
vspprintf(&tmp, 0, message, args); /* build message */
|
||||
strs[0] = PW32G(log_header); /* write header */
|
||||
strs[1] = tmp; /* then the message */
|
||||
/* report the event */
|
||||
ReportEvent(PW32G(log_source), etype, (unsigned short) priority, evid, NULL, 2, 0, strs, NULL);
|
||||
va_end(args);
|
||||
efree(tmp);
|
||||
}
|
||||
|
||||
@@ -127,7 +133,6 @@ void openlog(const char *ident, int logopt, int facility)
|
||||
PW32G(log_source) = RegisterEventSource(NULL, "PHP-" PHP_VERSION);
|
||||
spprintf(&PW32G(log_header), 0, (logopt & LOG_PID) ? "%s[%d]" : "%s", ident, getpid());
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
|
||||
Reference in New Issue
Block a user