diff options
author | qwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-01-18 22:50:23 +0000 |
---|---|---|
committer | qwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-01-18 22:50:23 +0000 |
commit | c0d4b5b229746929d5433ad0f5bfa0271922506b (patch) | |
tree | c6bddff5b1c091cea382447d51eaec2382e2fde7 /main/pbx.c | |
parent | 0b18c72ed2cec22b08ee8afb0ed6cbb36f31a5a7 (diff) |
Add some more checks for option_debug before ast_log(LOG_DEBUG, ...) calls.
Issue 8832, patch(es) by tgrman
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@51265 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/pbx.c')
-rw-r--r-- | main/pbx.c | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/main/pbx.c b/main/pbx.c index 152727ba2..41ad2312d 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -1619,7 +1619,8 @@ static void pbx_substitute_variables_helper_full(struct ast_channel *c, struct v /* Evaluate function */ cp4 = ast_func_read(c, vars, workspace, VAR_BUF_SIZE) ? NULL : workspace; - ast_log(LOG_DEBUG, "Function result is '%s'\n", cp4 ? cp4 : "(null)"); + if (option_debug) + ast_log(LOG_DEBUG, "Function result is '%s'\n", cp4 ? cp4 : "(null)"); } else { /* Retrieve variable value */ pbx_retrieve_variable(c, vars, &cp4, workspace, VAR_BUF_SIZE, headp); @@ -1686,7 +1687,8 @@ static void pbx_substitute_variables_helper_full(struct ast_channel *c, struct v length = ast_expr(vars, cp2, count); if (length) { - ast_log(LOG_DEBUG, "Expression result is '%s'\n", cp2); + if (option_debug) + ast_log(LOG_DEBUG, "Expression result is '%s'\n", cp2); count -= length; cp2 += length; } @@ -1822,7 +1824,8 @@ static int pbx_extension_helper(struct ast_channel *c, struct ast_context *con, ast_log(LOG_NOTICE, "No such label '%s' in extension '%s' in context '%s'\n", label, exten, context); break; default: - ast_log(LOG_DEBUG, "Shouldn't happen!\n"); + if (option_debug) + ast_log(LOG_DEBUG, "Shouldn't happen!\n"); } return (matching_action) ? 0 : -1; @@ -2346,7 +2349,8 @@ static int __ast_pbx_run(struct ast_channel *c) if ((res = ast_spawn_extension(c, c->context, c->exten, c->priority, c->cid.cid_num))) { /* Something bad happened, or a hangup has been requested. */ if (strchr("0123456789ABCDEF*#", res)) { - ast_log(LOG_DEBUG, "Oooh, got something to jump out with ('%c')!\n", res); + if (option_debug) + ast_log(LOG_DEBUG, "Oooh, got something to jump out with ('%c')!\n", res); pos = 0; dst_exten[pos++] = digit = res; dst_exten[pos] = '\0'; @@ -2381,8 +2385,9 @@ static int __ast_pbx_run(struct ast_channel *c) c->whentohangup = 0; c->_softhangup &= ~AST_SOFTHANGUP_TIMEOUT; } else if (c->_softhangup) { - ast_log(LOG_DEBUG, "Extension %s, priority %d returned normally even though call was hung up\n", - c->exten, c->priority); + if (option_debug) + ast_log(LOG_DEBUG, "Extension %s, priority %d returned normally even though call was hung up\n", + c->exten, c->priority); error = 1; break; } @@ -3896,7 +3901,8 @@ void ast_merge_contexts_and_delete(struct ast_context **extcontexts, const char tmp = *extcontexts; if (registrar) { /* XXX remove previous contexts from same registrar */ - ast_log(LOG_DEBUG, "must remove any reg %s\n", registrar); + if (option_debug) + ast_log(LOG_DEBUG, "must remove any reg %s\n", registrar); __ast_context_destroy(NULL,registrar); while (tmp) { lasttmp = tmp; @@ -4785,11 +4791,13 @@ int ast_add_extension2(struct ast_context *con, } if (option_debug) { if (tmp->matchcid) { - ast_log(LOG_DEBUG, "Added extension '%s' priority %d (CID match '%s') to %s\n", - tmp->exten, tmp->priority, tmp->cidmatch, con->name); + if (option_debug) + ast_log(LOG_DEBUG, "Added extension '%s' priority %d (CID match '%s') to %s\n", + tmp->exten, tmp->priority, tmp->cidmatch, con->name); } else { - ast_log(LOG_DEBUG, "Added extension '%s' priority %d to %s\n", - tmp->exten, tmp->priority, con->name); + if (option_debug) + ast_log(LOG_DEBUG, "Added extension '%s' priority %d to %s\n", + tmp->exten, tmp->priority, con->name); } } if (option_verbose > 2) { @@ -5225,7 +5233,8 @@ void __ast_context_destroy(struct ast_context *con, const char *registrar) for (tmp = contexts; tmp; ) { struct ast_context *next; /* next starting point */ for (; tmp; tmpl = tmp, tmp = tmp->next) { - ast_log(LOG_DEBUG, "check ctx %s %s\n", tmp->name, tmp->registrar); + if (option_debug) + ast_log(LOG_DEBUG, "check ctx %s %s\n", tmp->name, tmp->registrar); if ( (!registrar || !strcasecmp(registrar, tmp->registrar)) && (!con || !strcasecmp(tmp->name, con->name)) ) break; /* found it */ @@ -5233,7 +5242,8 @@ void __ast_context_destroy(struct ast_context *con, const char *registrar) if (!tmp) /* not found, we are done */ break; ast_mutex_lock(&tmp->lock); - ast_log(LOG_DEBUG, "delete ctx %s %s\n", tmp->name, tmp->registrar); + if (option_debug) + ast_log(LOG_DEBUG, "delete ctx %s %s\n", tmp->name, tmp->registrar); next = tmp->next; if (tmpl) tmpl->next = next; @@ -5927,7 +5937,8 @@ static int pbx_builtin_gotoif(struct ast_channel *chan, void *data) branch = pbx_checkcondition(condition) ? branch1 : branch2; if (ast_strlen_zero(branch)) { - ast_log(LOG_DEBUG, "Not taking any branch\n"); + if (option_debug) + ast_log(LOG_DEBUG, "Not taking any branch\n"); return 0; } |