From 5d2526540387c8d246ab3a2cc20f293d0195ccc8 Mon Sep 17 00:00:00 2001 From: Jason Parker Date: Thu, 18 Jan 2007 22:56:35 +0000 Subject: Merged revisions 51265 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r51265 | qwell | 2007-01-18 16:50:23 -0600 (Thu, 18 Jan 2007) | 4 lines Add some more checks for option_debug before ast_log(LOG_DEBUG, ...) calls. Issue 8832, patch(es) by tgrman ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@51266 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_voicemail.c | 15 ++++++++++----- funcs/func_strings.c | 1 + main/pbx.c | 10 ++++++---- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 44b38cc5b..25c9d6393 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -1985,12 +1985,14 @@ static void make_email_file(FILE *p, char *srcemail, struct ast_vm_user *vmu, in create_dirpath(tmpdir, sizeof(tmpdir), vmu->context, vmu->mailbox, "tmp"); snprintf(newtmp, sizeof(newtmp), "%s/XXXXXX", tmpdir); tmpfd = mkstemp(newtmp); - ast_log(LOG_DEBUG, "newtmp: %s\n", newtmp); + if (option_debug > 2) + ast_log(LOG_DEBUG, "newtmp: %s\n", newtmp); if (vmu->volgain < -.001 || vmu->volgain > .001) { snprintf(tmpcmd, sizeof(tmpcmd), "sox -v %.4f %s.%s %s.%s", vmu->volgain, attach, format, newtmp, format); ast_safe_system(tmpcmd); attach = newtmp; - ast_log(LOG_DEBUG, "VOLGAIN: Stored at: %s.%s - Level: %.4f - Mailbox: %s\n", attach, format, vmu->volgain, mailbox); + if (option_debug > 2) + ast_log(LOG_DEBUG, "VOLGAIN: Stored at: %s.%s - Level: %.4f - Mailbox: %s\n", attach, format, vmu->volgain, mailbox); } fprintf(p, "--%s\r\n", bound); fprintf(p, "Content-Type: %s%s; name=\"msg%04d.%s\"\r\n", ctype, format, msgnum, format); @@ -2027,7 +2029,8 @@ static int sendmail(char *srcemail, struct ast_vm_user *vmu, int msgnum, char *c } if (!strcmp(format, "wav49")) format = "WAV"; - ast_log(LOG_DEBUG, "Attaching file '%s', format '%s', uservm is '%d', global is %d\n", attach, format, attach_user_voicemail, ast_test_flag((&globalflags), VM_ATTACH)); + if (option_debug > 2) + ast_log(LOG_DEBUG, "Attaching file '%s', format '%s', uservm is '%d', global is %d\n", attach, format, attach_user_voicemail, ast_test_flag((&globalflags), VM_ATTACH)); /* Make a temporary file instead of piping directly to sendmail, in case the mail command hangs */ if ((p = vm_mkftemp(tmp)) == NULL) { @@ -4649,7 +4652,8 @@ static int init_mailstream(struct vm_state *vms, int box) if(option_debug > 2) ast_log (LOG_DEBUG,"vm_state user is:%s\n",vms->imapuser); if (vms->mailstream == NIL || !vms->mailstream) { - ast_log (LOG_DEBUG,"mailstream not set.\n"); + if (option_debug) + ast_log (LOG_DEBUG,"mailstream not set.\n"); } else { stream = vms->mailstream; } @@ -6407,7 +6411,8 @@ static int vm_execmain(struct ast_channel *chan, void *data) if(option_debug > 2) ast_log(LOG_DEBUG, "Checking quotas: comparing %u to %u\n",vms.quota_usage,vms.quota_limit); if (vms.quota_limit && vms.quota_usage >= vms.quota_limit) { - ast_log(LOG_DEBUG, "*** QUOTA EXCEEDED!!\n"); + if (option_debug) + ast_log(LOG_DEBUG, "*** QUOTA EXCEEDED!!\n"); cmd = ast_play_and_wait(chan, "vm-mailboxfull"); } #endif diff --git a/funcs/func_strings.c b/funcs/func_strings.c index de87c197a..af59944b6 100644 --- a/funcs/func_strings.c +++ b/funcs/func_strings.c @@ -35,6 +35,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include #include "asterisk/module.h" +#include "asterisk/options.h" #include "asterisk/channel.h" #include "asterisk/pbx.h" #include "asterisk/logger.h" diff --git a/main/pbx.c b/main/pbx.c index 1f656adea..62de9e501 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -4750,11 +4750,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) { -- cgit v1.2.3