summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/snuffleupagus.c11
-rw-r--r--src/sp_utils.h9
2 files changed, 20 insertions, 0 deletions
diff --git a/src/snuffleupagus.c b/src/snuffleupagus.c
index 7bf3649..1ac04d0 100644
--- a/src/snuffleupagus.c
+++ b/src/snuffleupagus.c
@@ -13,6 +13,10 @@
13static PHP_INI_MH(OnUpdateConfiguration); 13static PHP_INI_MH(OnUpdateConfiguration);
14static inline void sp_op_array_handler(zend_op_array *op); 14static inline void sp_op_array_handler(zend_op_array *op);
15 15
16#ifdef SP_DEBUG_STDERR
17int sp_debug_stderr = STDERR_FILENO;
18#endif
19
16ZEND_EXTENSION(); 20ZEND_EXTENSION();
17 21
18// LCOV_EXCL_START 22// LCOV_EXCL_START
@@ -70,6 +74,10 @@ ZEND_DLEXPORT zend_extension zend_extension_entry = {
70 STANDARD_ZEND_EXTENSION_PROPERTIES}; 74 STANDARD_ZEND_EXTENSION_PROPERTIES};
71 75
72PHP_GINIT_FUNCTION(snuffleupagus) { 76PHP_GINIT_FUNCTION(snuffleupagus) {
77#ifdef SP_DEBUG_STDERR
78 sp_debug_stderr = dup(STDERR_FILENO);
79#endif
80 sp_log_debug("(GINIT)");
73 snuffleupagus_globals->is_config_valid = SP_CONFIG_NONE; 81 snuffleupagus_globals->is_config_valid = SP_CONFIG_NONE;
74 snuffleupagus_globals->in_eval = 0; 82 snuffleupagus_globals->in_eval = 0;
75 83
@@ -116,6 +124,7 @@ PHP_GINIT_FUNCTION(snuffleupagus) {
116} 124}
117 125
118PHP_MINIT_FUNCTION(snuffleupagus) { 126PHP_MINIT_FUNCTION(snuffleupagus) {
127 sp_log_debug("(MINIT)");
119 REGISTER_INI_ENTRIES(); 128 REGISTER_INI_ENTRIES();
120 129
121 return SUCCESS; 130 return SUCCESS;
@@ -244,6 +253,8 @@ PHP_MINFO_FUNCTION(snuffleupagus) {
244} 253}
245 254
246static PHP_INI_MH(OnUpdateConfiguration) { 255static PHP_INI_MH(OnUpdateConfiguration) {
256 sp_log_debug("(OnUpdateConfiguration)");
257
247 TSRMLS_FETCH(); 258 TSRMLS_FETCH();
248 259
249 if (!new_value || !new_value->len) { 260 if (!new_value || !new_value->len) {
diff --git a/src/sp_utils.h b/src/sp_utils.h
index 081f786..b5a1691 100644
--- a/src/sp_utils.h
+++ b/src/sp_utils.h
@@ -51,9 +51,18 @@
51 sp_log_msgf(feature, SP_LOG_ERROR, SP_TYPE_LOG, __VA_ARGS__) 51 sp_log_msgf(feature, SP_LOG_ERROR, SP_TYPE_LOG, __VA_ARGS__)
52#define sp_log_warn(feature, ...) \ 52#define sp_log_warn(feature, ...) \
53 sp_log_msgf(feature, SP_LOG_WARN, SP_TYPE_LOG, __VA_ARGS__) 53 sp_log_msgf(feature, SP_LOG_WARN, SP_TYPE_LOG, __VA_ARGS__)
54
54#ifdef SP_DEBUG 55#ifdef SP_DEBUG
56
57#ifdef SP_DEBUG_STDERR
58extern int sp_debug_stderr;
59#define sp_log_debug(fmt, ...) \
60 dprintf(sp_debug_stderr, "[snuffleupagus][DEBUG] %s(): " fmt "\n", __FUNCTION__, ##__VA_ARGS__);
61#else
55#define sp_log_debug(...) \ 62#define sp_log_debug(...) \
56 sp_log_msgf("DEBUG", SP_LOG_DEBUG, SP_TYPE_LOG, __VA_ARGS__) 63 sp_log_msgf("DEBUG", SP_LOG_DEBUG, SP_TYPE_LOG, __VA_ARGS__)
64#endif
65
57#else 66#else
58#define sp_log_debug(...) 67#define sp_log_debug(...)
59#endif 68#endif