Browse code

core: print modparam type as string in log message

Daniel-Constantin Mierla authored on 26/11/2019 14:18:22
Showing 1 changed files
... ...
@@ -34,6 +34,30 @@
34 34
 #include <regex.h>
35 35
 #include <string.h>
36 36
 
37
+static char *get_mod_param_type_str(int ptype)
38
+{
39
+	if(ptype & PARAM_USE_FUNC) {
40
+		if(ptype & PARAM_STRING) {
41
+			return "func-string";
42
+		} else if (ptype & PARAM_INT) {
43
+			return "func-int";
44
+		} else if (ptype & PARAM_STR) {
45
+			return "func-str";
46
+		} else {
47
+			return "func-unknown";
48
+		}
49
+	}
50
+	if(ptype & PARAM_STRING) {
51
+		return "string";
52
+	} else if (ptype & PARAM_INT) {
53
+		return "int";
54
+	} else if (ptype & PARAM_STR) {
55
+		return "str";
56
+	} else {
57
+		return "unknown";
58
+	}
59
+}
60
+
37 61
 int set_mod_param(char* _mod, char* _name, modparam_t _type, void* _val)
38 62
 {
39 63
 	return set_mod_param_regex(_mod, _name, _type, _val);
... ...
@@ -137,8 +161,8 @@ int set_mod_param_regex(char* regex, char* name, modparam_t type, void* val)
137 137
 				}
138 138
 			}
139 139
 			else {
140
-				LM_ERR("parameter <%s> of type <%d> not found in module <%s>\n",
141
-						name, type, t->exports.name);
140
+				LM_ERR("parameter <%s> of type <%d:%s> not found in module <%s>\n",
141
+						name, type, get_mod_param_type_str(type), t->exports.name);
142 142
 				regfree(&preg);
143 143
 				pkg_free(reg);
144 144
 				return -3;