Module: kamailio
Branch: master
Commit: 2bf7b94146971ad3cbefe167c52036a18c8566c0
URL:
https://github.com/kamailio/kamailio/commit/2bf7b94146971ad3cbefe167c52036a…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-09-26T20:07:20+02:00
db_redis: control printing all db tables via parameter verbosity
- the list can be long and the output can make waching logs harder for
rpc commands that connect/disconnect each time
---
Modified: src/modules/db_redis/db_redis_mod.c
Modified: src/modules/db_redis/redis_connection.c
---
Diff:
https://github.com/kamailio/kamailio/commit/2bf7b94146971ad3cbefe167c52036a…
Patch:
https://github.com/kamailio/kamailio/commit/2bf7b94146971ad3cbefe167c52036a…
---
diff --git a/src/modules/db_redis/db_redis_mod.c b/src/modules/db_redis/db_redis_mod.c
index 2b3b07fead..60547eeee1 100644
--- a/src/modules/db_redis/db_redis_mod.c
+++ b/src/modules/db_redis/db_redis_mod.c
@@ -33,6 +33,7 @@ MODULE_VERSION
str redis_keys = str_init("");
str redis_schema_path = str_init("/usr/share/kamailio/db_redis/kamailio");
+int db_redis_verbosity = 1;
static int db_redis_bind_api(db_func_t *dbb);
static int mod_init(void);
@@ -51,6 +52,7 @@ static cmd_export_t cmds[] = {
static param_export_t params[] = {
{"keys", PARAM_STRING|USE_FUNC_PARAM, (void*)keys_param},
{"schema_path", PARAM_STR, &redis_schema_path },
+ {"verbosity", PARAM_INT, &db_redis_verbosity },
{0, 0, 0}
};
diff --git a/src/modules/db_redis/redis_connection.c
b/src/modules/db_redis/redis_connection.c
index 69bb099800..2720c2753d 100644
--- a/src/modules/db_redis/redis_connection.c
+++ b/src/modules/db_redis/redis_connection.c
@@ -24,6 +24,8 @@
#include "redis_connection.h"
#include "redis_table.h"
+extern int db_redis_verbosity;
+
static void print_query(redis_key_t *query) {
redis_key_t *k;
@@ -217,7 +219,7 @@ km_redis_con_t* db_redis_new_connection(const struct db_id* id) {
goto err;
}
- db_redis_print_all_tables(ptr);
+ if(db_redis_verbosity > 0) db_redis_print_all_tables(ptr);
ptr->ref = 1;
ptr->append_counter = 0;