Skip to content

Commit

Permalink
core: print modparam type as string in log message
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Nov 26, 2019
1 parent a0e04cb commit f35fd46
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions src/core/modparam.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f35fd46

Please sign in to comment.