diff options
| author | xXx-caillou-xXx | 2018-08-28 14:24:29 +0200 |
|---|---|---|
| committer | jvoisin | 2018-08-28 12:24:29 +0000 |
| commit | aa5d6895d0ac8c6ea050a8ea55e2f8a39ddfe365 (patch) | |
| tree | c640e50ab007bae3a2fd55ca05bc13c73e293c69 /src/sp_utils.h | |
| parent | eff2c658d37108020215f838d4c47c176ec3e050 (diff) | |
Use php's logging functions
This commit replace our usage of `php_log_err` with `zend_error`. This should
allow administrators to display errors in the webpage, should they want to;
and to properly manipulate the verbosity's level.
This should close #217
Diffstat (limited to '')
| -rw-r--r-- | src/sp_utils.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/sp_utils.h b/src/sp_utils.h index 7e1103c..62040e7 100644 --- a/src/sp_utils.h +++ b/src/sp_utils.h | |||
| @@ -28,12 +28,14 @@ | |||
| 28 | #define HOOK_FUNCTION_BY_REGEXP(regexp, hook_table, new_function) \ | 28 | #define HOOK_FUNCTION_BY_REGEXP(regexp, hook_table, new_function) \ |
| 29 | hook_regexp(regexp, SNUFFLEUPAGUS_G(hook_table), new_function) | 29 | hook_regexp(regexp, SNUFFLEUPAGUS_G(hook_table), new_function) |
| 30 | 30 | ||
| 31 | #define SP_LOG_SIMULATION "simulation" | 31 | #define SP_LOG_SIMULATION E_WARNING |
| 32 | #define SP_LOG_DROP "drop" | 32 | #define SP_LOG_DROP E_ERROR |
| 33 | #define SP_LOG_DEBUG "debug" | 33 | #define SP_LOG_DEBUG E_NOTICE |
| 34 | #define SP_LOG_ERROR "error" | 34 | #define SP_LOG_ERROR E_ERROR |
| 35 | #define SP_LOG_WARN E_WARNING | ||
| 35 | 36 | ||
| 36 | #define sp_log_err(feature, ...) sp_log_msg(feature, SP_LOG_ERROR, __VA_ARGS__) | 37 | #define sp_log_err(feature, ...) sp_log_msg(feature, SP_LOG_ERROR, __VA_ARGS__) |
| 38 | #define sp_log_warn(feature, ...) sp_log_msg(feature, SP_LOG_WARN, __VA_ARGS__) | ||
| 37 | #ifdef SP_DEBUG | 39 | #ifdef SP_DEBUG |
| 38 | #define sp_log_debug(...) sp_log_msg("DEBUG", SP_LOG_DEBUG, __VA_ARGS__) | 40 | #define sp_log_debug(...) sp_log_msg("DEBUG", SP_LOG_DEBUG, __VA_ARGS__) |
| 39 | #else | 41 | #else |
| @@ -42,15 +44,14 @@ | |||
| 42 | 44 | ||
| 43 | #define GET_SUFFIX(x) (x == 1) ? "st" : ((x == 2) ? "nd" : "th") | 45 | #define GET_SUFFIX(x) (x == 1) ? "st" : ((x == 2) ? "nd" : "th") |
| 44 | 46 | ||
| 45 | void sp_log_msg(char const *feature, char const *level, const char *fmt, ...); | 47 | void sp_log_msg(char const *feature, int type, const char *fmt, ...); |
| 46 | int compute_hash(const char *const filename, char *file_hash); | 48 | int compute_hash(const char *const filename, char *file_hash); |
| 47 | const zend_string *sp_zval_to_zend_string(zval *); | 49 | const zend_string *sp_zval_to_zend_string(zval *); |
| 48 | bool sp_match_value(const zend_string *, const zend_string *, const sp_pcre *); | 50 | bool sp_match_value(const zend_string *, const zend_string *, const sp_pcre *); |
| 49 | bool sp_match_array_key(const zval *, const zend_string *, const sp_pcre *); | 51 | bool sp_match_array_key(const zval *, const zend_string *, const sp_pcre *); |
| 50 | bool sp_match_array_value(const zval *, const zend_string *, const sp_pcre *); | 52 | bool sp_match_array_value(const zval *, const zend_string *, const sp_pcre *); |
| 51 | void sp_log_disable(const char *restrict, const char *restrict, | 53 | void sp_log_disable(const char *restrict, const char *restrict, |
| 52 | const zend_string *restrict, const sp_disabled_function *, | 54 | const zend_string *restrict, const sp_disabled_function *); |
| 53 | unsigned int, const char *restrict); | ||
| 54 | void sp_log_disable_ret(const char *restrict, const zend_string *restrict, | 55 | void sp_log_disable_ret(const char *restrict, const zend_string *restrict, |
| 55 | const sp_disabled_function *); | 56 | const sp_disabled_function *); |
| 56 | int hook_function(const char *, HashTable *, | 57 | int hook_function(const char *, HashTable *, |
