[sr-dev] git:master:f35fd46d: core: print modparam type as string in log message

Daniel-Constantin Mierla miconda at gmail.com
Tue Nov 26 15:19:09 CET 2019


Module: kamailio
Branch: master
Commit: f35fd46de42a26d910e637023396a801c0ad404c
URL: https://github.com/kamailio/kamailio/commit/f35fd46de42a26d910e637023396a801c0ad404c

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-11-26T15:18:22+01:00

core: print modparam type as string in log message

---

Modified: src/core/modparam.c

---

Diff:  https://github.com/kamailio/kamailio/commit/f35fd46de42a26d910e637023396a801c0ad404c.diff
Patch: https://github.com/kamailio/kamailio/commit/f35fd46de42a26d910e637023396a801c0ad404c.patch

---

diff --git a/src/core/modparam.c b/src/core/modparam.c
index 1a7d8acd78..e169e651a2 100644
--- a/src/core/modparam.c
+++ b/src/core/modparam.c
@@ -34,6 +34,30 @@
 #include <regex.h>
 #include <string.h>
 
+static char *get_mod_param_type_str(int ptype)
+{
+	if(ptype & PARAM_USE_FUNC) {
+		if(ptype & PARAM_STRING) {
+			return "func-string";
+		} else if (ptype & PARAM_INT) {
+			return "func-int";
+		} else if (ptype & PARAM_STR) {
+			return "func-str";
+		} else {
+			return "func-unknown";
+		}
+	}
+	if(ptype & PARAM_STRING) {
+		return "string";
+	} else if (ptype & PARAM_INT) {
+		return "int";
+	} else if (ptype & PARAM_STR) {
+		return "str";
+	} else {
+		return "unknown";
+	}
+}
+
 int set_mod_param(char* _mod, char* _name, modparam_t _type, void* _val)
 {
 	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)
 				}
 			}
 			else {
-				LM_ERR("parameter <%s> of type <%d> not found in module <%s>\n",
-						name, type, t->exports.name);
+				LM_ERR("parameter <%s> of type <%d:%s> not found in module <%s>\n",
+						name, type, get_mod_param_type_str(type), t->exports.name);
 				regfree(&preg);
 				pkg_free(reg);
 				return -3;




More information about the sr-dev mailing list