aboutsummaryrefslogtreecommitdiffstats
path: root/funcs
diff options
context:
space:
mode:
Diffstat (limited to 'funcs')
-rw-r--r--funcs/func_db.c13
-rw-r--r--funcs/func_rand.c9
-rw-r--r--funcs/func_strings.c12
3 files changed, 22 insertions, 12 deletions
diff --git a/funcs/func_db.c b/funcs/func_db.c
index 13932d27d..2ad135fa0 100644
--- a/funcs/func_db.c
+++ b/funcs/func_db.c
@@ -67,8 +67,9 @@ static int function_db_read(struct ast_channel *chan, char *cmd,
}
if (ast_db_get(args.family, args.key, buf, len - 1)) {
- ast_log(LOG_DEBUG, "DB: %s/%s not found in database.\n", args.family,
- args.key);
+ if (option_debug)
+ ast_log(LOG_DEBUG, "DB: %s/%s not found in database.\n", args.family,
+ args.key);
} else
pbx_builtin_setvar_helper(chan, "DB_RESULT", buf);
@@ -182,11 +183,13 @@ static int function_db_delete(struct ast_channel *chan, char* cmd,
}
if (ast_db_get(args.family, args.key, buf, len - 1)) {
- ast_log(LOG_DEBUG, "DB_DELETE: %s/%s not found in database.\n", args.family, args.key);
+ if (option_debug)
+ ast_log(LOG_DEBUG, "DB_DELETE: %s/%s not found in database.\n", args.family, args.key);
} else {
if (ast_db_del(args.family, args.key)) {
- ast_log(LOG_DEBUG, "DB_DELETE: %s/%s could not be deleted from the database\n",
- args.family, args.key);
+ if (option_debug)
+ ast_log(LOG_DEBUG, "DB_DELETE: %s/%s could not be deleted from the database\n",
+ args.family, args.key);
}
}
pbx_builtin_setvar_helper(chan, "DB_RESULT", buf);
diff --git a/funcs/func_rand.c b/funcs/func_rand.c
index a216754ac..67bc8e931 100644
--- a/funcs/func_rand.c
+++ b/funcs/func_rand.c
@@ -38,6 +38,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/logger.h"
#include "asterisk/utils.h"
#include "asterisk/app.h"
+#include "asterisk/options.h"
static int acf_rand_exec(struct ast_channel *chan, char *cmd,
char *parse, char *buffer, size_t buflen)
@@ -64,12 +65,14 @@ static int acf_rand_exec(struct ast_channel *chan, char *cmd,
max_int = min_int;
min_int = tmp;
- ast_log(LOG_DEBUG, "max<min\n");
+ if (option_debug)
+ ast_log(LOG_DEBUG, "max<min\n");
}
response_int = min_int + (ast_random() % (max_int - min_int + 1));
- ast_log(LOG_DEBUG, "%d was the lucky number in range [%d,%d]\n",
- response_int, min_int, max_int);
+ if (option_debug)
+ ast_log(LOG_DEBUG, "%d was the lucky number in range [%d,%d]\n",
+ response_int, min_int, max_int);
snprintf(buffer, buflen, "%d", response_int);
ast_module_user_remove(u);
diff --git a/funcs/func_strings.c b/funcs/func_strings.c
index e9abe50c2..6f7b54902 100644
--- a/funcs/func_strings.c
+++ b/funcs/func_strings.c
@@ -41,6 +41,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/utils.h"
#include "asterisk/app.h"
#include "asterisk/localtime.h"
+#include "asterisk/options.h"
static int function_fieldqty(struct ast_channel *chan, char *cmd,
char *parse, char *buf, size_t len)
@@ -126,7 +127,8 @@ static int regex(struct ast_channel *chan, char *cmd, char *parse, char *buf,
if ((*args.str == ' ') || (*args.str == '\t'))
args.str++;
- ast_log(LOG_DEBUG, "FUNCTION REGEX (%s)(%s)\n", args.reg, args.str);
+ if (option_debug)
+ ast_log(LOG_DEBUG, "FUNCTION REGEX (%s)(%s)\n", args.reg, args.str);
if ((errcode = regcomp(&regexbuf, args.reg, REG_EXTENDED | REG_NOSUB))) {
regerror(errcode, &regexbuf, buf, len);
@@ -175,7 +177,8 @@ static int array(struct ast_channel *chan, char *cmd, char *var,
* want them to be surprised by the result. Hence, we prefer commas as the
* delimiter, but we'll fall back to vertical bars if commas aren't found.
*/
- ast_log(LOG_DEBUG, "array (%s=%s)\n", var, value2);
+ if (option_debug)
+ ast_log(LOG_DEBUG, "array (%s=%s)\n", var, value2);
if (strchr(var, ','))
AST_NONSTANDARD_APP_ARGS(arg1, var, ',');
else
@@ -187,8 +190,9 @@ static int array(struct ast_channel *chan, char *cmd, char *var,
AST_STANDARD_APP_ARGS(arg2, value2);
for (i = 0; i < arg1.argc; i++) {
- ast_log(LOG_DEBUG, "array set value (%s=%s)\n", arg1.var[i],
- arg2.val[i]);
+ if (option_debug)
+ ast_log(LOG_DEBUG, "array set value (%s=%s)\n", arg1.var[i],
+ arg2.val[i]);
if (i < arg2.argc) {
pbx_builtin_setvar_helper(chan, arg1.var[i], arg2.val[i]);
} else {