diff options
author | Erik Lundin <erik@coretech.se> | 2019-06-15 09:31:16 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-06-17 13:13:25 +0200 |
commit | 9f0515c40c85d9c22cf46f7c42338354c398e4a7 (patch) | |
tree | 8276aa2ec103caa3d55b5a8225872b83dad6b7c9 /main | |
parent | 96a6f7f7f572875e0d18de21f5f67429d1ffe099 (diff) | |
download | php-git-9f0515c40c85d9c22cf46f7c42338354c398e4a7.tar.gz |
Add syslog.filter=raw
This passes through syslog message unchanged, without splitting
messages at newlines.
Diffstat (limited to 'main')
-rw-r--r-- | main/main.c | 4 | ||||
-rw-r--r-- | main/php_syslog.c | 7 | ||||
-rw-r--r-- | main/php_syslog.h | 1 |
3 files changed, 12 insertions, 0 deletions
diff --git a/main/main.c b/main/main.c index ee422db52f..98c0a26f43 100644 --- a/main/main.c +++ b/main/main.c @@ -346,6 +346,10 @@ static PHP_INI_MH(OnSetLogFilter) PG(syslog_filter) = PHP_SYSLOG_FILTER_ASCII; return SUCCESS; } + if (!strcmp(filter, "raw")) { + PG(syslog_filter) = PHP_SYSLOG_FILTER_RAW; + return SUCCESS; + } return FAILURE; } diff --git a/main/php_syslog.c b/main/php_syslog.c index dd16f05217..561a63cf00 100644 --- a/main/php_syslog.c +++ b/main/php_syslog.c @@ -77,6 +77,13 @@ PHPAPI void php_syslog(int priority, const char *format, ...) /* {{{ */ smart_string_0(&fbuf); va_end(args); + if (PG(syslog_filter) == PHP_SYSLOG_FILTER_RAW) { + /* Just send it directly to the syslog */ + syslog(priority, "%.*s", (int)fbuf.len, fbuf.c); + smart_string_free(&fbuf); + return; + } + for (ptr = fbuf.c; ; ++ptr) { c = *ptr; if (c == '\0') { diff --git a/main/php_syslog.h b/main/php_syslog.h index dee0e5aaa3..401f498194 100644 --- a/main/php_syslog.h +++ b/main/php_syslog.h @@ -34,6 +34,7 @@ #define PHP_SYSLOG_FILTER_ALL 0 #define PHP_SYSLOG_FILTER_NO_CTRL 1 #define PHP_SYSLOG_FILTER_ASCII 2 +#define PHP_SYSLOG_FILTER_RAW 3 BEGIN_EXTERN_C() PHPAPI void php_syslog(int, const char *format, ...); |