diff options
| author | jvoisin | 2020-07-04 21:36:10 +0200 |
|---|---|---|
| committer | jvoisin | 2020-07-04 21:36:10 +0200 |
| commit | 4e896399011737e5836f5091ada66a4191902591 (patch) | |
| tree | 08584047a86cf00dcc3b59bb5ba8248cda2c4ffa /src/sp_utils.c | |
| parent | d4936a46b6693d374d900d45b5c1642a618148bc (diff) | |
Reorder some declaration
So that the syslog part is tight as possible
Diffstat (limited to 'src/sp_utils.c')
| -rw-r--r-- | src/sp_utils.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/sp_utils.c b/src/sp_utils.c index 2665c28..e752d24 100644 --- a/src/sp_utils.c +++ b/src/sp_utils.c | |||
| @@ -32,11 +32,11 @@ void sp_log_msg(char const* feature, int type, const char* fmt, ...) { | |||
| 32 | 32 | ||
| 33 | const char* client_ip = get_ipaddr(); | 33 | const char* client_ip = get_ipaddr(); |
| 34 | switch (SNUFFLEUPAGUS_G(config).log_media) { | 34 | switch (SNUFFLEUPAGUS_G(config).log_media) { |
| 35 | case SP_SYSLOG: | 35 | case SP_SYSLOG: { |
| 36 | openlog(PHP_SNUFFLEUPAGUS_EXTNAME, LOG_PID, LOG_AUTH); | ||
| 37 | const char* error_filename = zend_get_executed_filename(); | 36 | const char* error_filename = zend_get_executed_filename(); |
| 38 | int syslog_level = (type == SP_LOG_DROP) ? LOG_ERR : LOG_INFO; | 37 | int syslog_level = (type == SP_LOG_DROP) ? LOG_ERR : LOG_INFO; |
| 39 | int error_lineno = zend_get_executed_lineno(TSRMLS_C); | 38 | int error_lineno = zend_get_executed_lineno(TSRMLS_C); |
| 39 | openlog(PHP_SNUFFLEUPAGUS_EXTNAME, LOG_PID, LOG_AUTH); | ||
| 40 | syslog(syslog_level, "[snuffleupagus][%s][%s] %s in %s on line %d", | 40 | syslog(syslog_level, "[snuffleupagus][%s][%s] %s in %s on line %d", |
| 41 | client_ip, feature, msg, error_filename, error_lineno); | 41 | client_ip, feature, msg, error_filename, error_lineno); |
| 42 | closelog(); | 42 | closelog(); |
| @@ -44,6 +44,7 @@ void sp_log_msg(char const* feature, int type, const char* fmt, ...) { | |||
| 44 | zend_bailout(); | 44 | zend_bailout(); |
| 45 | } | 45 | } |
| 46 | break; | 46 | break; |
| 47 | } | ||
| 47 | case SP_ZEND: | 48 | case SP_ZEND: |
| 48 | default: | 49 | default: |
| 49 | zend_error(type, "[snuffleupagus][%s][%s] %s", client_ip, feature, msg); | 50 | zend_error(type, "[snuffleupagus][%s][%s] %s", client_ip, feature, msg); |
