Merged revisions 51265 via svnmerge from
authorJason Parker <jparker@digium.com>
Thu, 18 Jan 2007 22:56:35 +0000 (22:56 +0000)
committerJason Parker <jparker@digium.com>
Thu, 18 Jan 2007 22:56:35 +0000 (22:56 +0000)
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
funcs/func_strings.c
main/pbx.c

index 44b38cc..25c9d63 100644 (file)
@@ -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
index de87c19..af59944 100644 (file)
@@ -35,6 +35,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include <regex.h>
 
 #include "asterisk/module.h"
+#include "asterisk/options.h"
 #include "asterisk/channel.h"
 #include "asterisk/pbx.h"
 #include "asterisk/logger.h"
index 1f656ad..62de9e5 100644 (file)
@@ -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) {