summaryrefslogtreecommitdiff
path: root/src/sp_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sp_utils.c')
-rw-r--r--src/sp_utils.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/src/sp_utils.c b/src/sp_utils.c
index 8032e0a..4c78ce5 100644
--- a/src/sp_utils.c
+++ b/src/sp_utils.c
@@ -41,7 +41,7 @@ const char* get_ipaddr() {
41} 41}
42 42
43void sp_log_msgf(char const* restrict feature, int level, int type, 43void sp_log_msgf(char const* restrict feature, int level, int type,
44 const char* restrict fmt, ...) { 44 const char* restrict fmt, ...) {
45 char* msg; 45 char* msg;
46 va_list args; 46 va_list args;
47 47
@@ -51,7 +51,7 @@ void sp_log_msgf(char const* restrict feature, int level, int type,
51 51
52 const char* client_ip = get_ipaddr(); 52 const char* client_ip = get_ipaddr();
53 const char* logtype = NULL; 53 const char* logtype = NULL;
54 switch(type) { 54 switch (type) {
55 case SP_TYPE_SIMULATION: 55 case SP_TYPE_SIMULATION:
56 logtype = "simulation"; 56 logtype = "simulation";
57 break; 57 break;
@@ -80,7 +80,8 @@ void sp_log_msgf(char const* restrict feature, int level, int type,
80 } 80 }
81 case SP_ZEND: 81 case SP_ZEND:
82 default: 82 default:
83 zend_error(level, "[snuffleupagus][%s][%s][%s] %s", client_ip, feature, logtype, msg); 83 zend_error(level, "[snuffleupagus][%s][%s][%s] %s", client_ip, feature,
84 logtype, msg);
84 break; 85 break;
85 } 86 }
86} 87}
@@ -280,26 +281,27 @@ void sp_log_disable(const char* restrict path, const char* restrict arg_name,
280 char_repr = zend_string_to_char(arg_value); 281 char_repr = zend_string_to_char(arg_value);
281 } 282 }
282 if (alias) { 283 if (alias) {
283 sp_log_auto("disabled_function", sim, 284 sp_log_auto(
284 "Aborted execution on call of the function '%s', " 285 "disabled_function", sim,
285 "because its argument '%s' content (%s) matched the rule '%s'", 286 "Aborted execution on call of the function '%s', "
286 path, arg_name, char_repr ? char_repr : "?", ZSTR_VAL(alias)); 287 "because its argument '%s' content (%s) matched the rule '%s'",
288 path, arg_name, char_repr ? char_repr : "?", ZSTR_VAL(alias));
287 } else { 289 } else {
288 sp_log_auto("disabled_function", sim, 290 sp_log_auto("disabled_function", sim,
289 "Aborted execution on call of the function '%s', " 291 "Aborted execution on call of the function '%s', "
290 "because its argument '%s' content (%s) matched a rule", 292 "because its argument '%s' content (%s) matched a rule",
291 path, arg_name, char_repr ? char_repr : "?"); 293 path, arg_name, char_repr ? char_repr : "?");
292 } 294 }
293 efree(char_repr); 295 efree(char_repr);
294 } else { 296 } else {
295 if (alias) { 297 if (alias) {
296 sp_log_auto("disabled_function", sim, 298 sp_log_auto("disabled_function", sim,
297 "Aborted execution on call of the function '%s', " 299 "Aborted execution on call of the function '%s', "
298 "because of the the rule '%s'", 300 "because of the the rule '%s'",
299 path, ZSTR_VAL(alias)); 301 path, ZSTR_VAL(alias));
300 } else { 302 } else {
301 sp_log_auto("disabled_function", sim, 303 sp_log_auto("disabled_function", sim,
302 "Aborted execution on call of the function '%s'", path); 304 "Aborted execution on call of the function '%s'", path);
303 } 305 }
304 } 306 }
305} 307}
@@ -327,9 +329,9 @@ void sp_log_disable_ret(const char* restrict path,
327 path, char_repr ? char_repr : "?", ZSTR_VAL(alias)); 329 path, char_repr ? char_repr : "?", ZSTR_VAL(alias));
328 } else { 330 } else {
329 sp_log_auto("disabled_function", sim, 331 sp_log_auto("disabled_function", sim,
330 "Aborted execution on return of the function '%s', " 332 "Aborted execution on return of the function '%s', "
331 "because the function returned '%s', which matched a rule", 333 "because the function returned '%s', which matched a rule",
332 path, char_repr ? char_repr : "?"); 334 path, char_repr ? char_repr : "?");
333 } 335 }
334 efree(char_repr); 336 efree(char_repr);
335} 337}