[asterisk-commits] russell: trunk r69327 - in /trunk: apps/ cdr/ channels/ codecs/ formats/ func...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jun 14 12:39:14 MST 2007


Author: russell
Date: Thu Jun 14 14:39:12 2007
New Revision: 69327

URL: http://svn.digium.com/view/asterisk?view=rev&rev=69327
Log:
Add a massive set of changes for converting to use the ast_debug() macro.
(issue #9957, patches from mvanbaak, caio1982, critch, and dimas)

Modified:
    trunk/apps/app_alarmreceiver.c
    trunk/apps/app_amd.c
    trunk/apps/app_channelredirect.c
    trunk/apps/app_chanspy.c
    trunk/apps/app_db.c
    trunk/apps/app_dial.c
    trunk/apps/app_directed_pickup.c
    trunk/apps/app_disa.c
    trunk/apps/app_festival.c
    trunk/apps/app_followme.c
    trunk/apps/app_ices.c
    trunk/apps/app_macro.c
    trunk/apps/app_meetme.c
    trunk/apps/app_minivm.c
    trunk/apps/app_mp3.c
    trunk/apps/app_nbscat.c
    trunk/apps/app_osplookup.c
    trunk/apps/app_queue.c
    trunk/apps/app_record.c
    trunk/apps/app_rpt.c
    trunk/apps/app_stack.c
    trunk/apps/app_talkdetect.c
    trunk/apps/app_test.c
    trunk/apps/app_voicemail.c
    trunk/apps/app_waitforsilence.c
    trunk/apps/app_zapbarge.c
    trunk/apps/app_zapras.c
    trunk/apps/app_zapscan.c
    trunk/cdr/cdr_csv.c
    trunk/cdr/cdr_odbc.c
    trunk/cdr/cdr_pgsql.c
    trunk/cdr/cdr_radius.c
    trunk/cdr/cdr_tds.c
    trunk/channels/chan_agent.c
    trunk/channels/chan_alsa.c
    trunk/channels/chan_features.c
    trunk/channels/chan_gtalk.c
    trunk/channels/chan_h323.c
    trunk/channels/chan_iax2.c
    trunk/channels/chan_jingle.c
    trunk/channels/chan_local.c
    trunk/channels/chan_mgcp.c
    trunk/channels/chan_misdn.c
    trunk/channels/chan_nbs.c
    trunk/channels/chan_phone.c
    trunk/channels/chan_sip.c
    trunk/channels/chan_skinny.c
    trunk/channels/chan_vpb.cc
    trunk/channels/chan_zap.c
    trunk/channels/iax2-provision.c
    trunk/codecs/codec_zap.c
    trunk/formats/format_g726.c
    trunk/formats/format_ogg_vorbis.c
    trunk/formats/format_wav.c
    trunk/funcs/func_db.c
    trunk/funcs/func_iconv.c
    trunk/funcs/func_rand.c
    trunk/funcs/func_strings.c
    trunk/funcs/func_version.c
    trunk/main/acl.c
    trunk/main/adsistub.c
    trunk/main/app.c
    trunk/main/asterisk.c
    trunk/main/callerid.c
    trunk/main/cdr.c
    trunk/main/channel.c
    trunk/main/config.c
    trunk/main/db.c
    trunk/main/devicestate.c
    trunk/main/dial.c
    trunk/main/dns.c
    trunk/main/dsp.c
    trunk/main/enum.c
    trunk/main/file.c
    trunk/main/frame.c
    trunk/res/res_adsi.c
    trunk/res/res_agi.c
    trunk/res/res_config_pgsql.c
    trunk/res/res_config_sqlite.c
    trunk/res/res_crypto.c
    trunk/res/res_features.c
    trunk/res/res_jabber.c
    trunk/res/res_monitor.c
    trunk/res/res_musiconhold.c
    trunk/res/res_smdi.c

Modified: trunk/apps/app_alarmreceiver.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_alarmreceiver.c?view=diff&rev=69327&r1=69326&r2=69327
==============================================================================
--- trunk/apps/app_alarmreceiver.c (original)
+++ trunk/apps/app_alarmreceiver.c Thu Jun 14 14:39:12 2007
@@ -251,16 +251,14 @@
 			if(option_verbose >= 4)
 				ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: DTMF Digit Timeout on %s\n", chan->name);
 				
-			if (option_debug)
-				ast_log(LOG_DEBUG,"AlarmReceiver: DTMF timeout on chan %s\n",chan->name);
+			ast_debug(1,"AlarmReceiver: DTMF timeout on chan %s\n",chan->name);
 				
 			res = 1;
 			break;
 		}
 		
 		if ((r = ast_waitfor(chan, -1) < 0)) {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Waitfor returned %d\n", r);
+			ast_debug(1, "Waitfor returned %d\n", r);
 			continue;
 		}
 			
@@ -355,8 +353,7 @@
 		if (option_verbose >= 3 )
 		ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: can't write metadata\n");	
 		
-		if (option_debug)
-			ast_log(LOG_DEBUG,"AlarmReceiver: can't write metadata\n");
+		ast_debug(1,"AlarmReceiver: can't write metadata\n");
 	}
 	else
 		res = 0;
@@ -407,8 +404,7 @@
 		if(fd == -1) {
 			if (option_verbose >= 3)
 				ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: can't make temporary file\n");	
-			if (option_debug)
-				ast_log(LOG_DEBUG,"AlarmReceiver: can't make temporary file\n");
+			ast_debug(1,"AlarmReceiver: can't make temporary file\n");
 			res = -1;
 		}
 		
@@ -529,8 +525,7 @@
 
 		if (option_verbose >= 2)
 			ast_verbose(VERBOSE_PREFIX_2 "AlarmReceiver: Received Event %s\n", event);
-		if (option_debug)
-			ast_log(LOG_DEBUG, "AlarmReceiver: Received event: %s\n", event);
+		ast_debug(1, "AlarmReceiver: Received event: %s\n", event);
 		
 		/* Calculate checksum */
 		
@@ -560,8 +555,7 @@
 			database_increment("checksum-errors");
 			if (option_verbose >= 2)
 				ast_verbose(VERBOSE_PREFIX_2 "AlarmReceiver: Nonzero checksum\n");
-			if (option_debug)
-				ast_log(LOG_DEBUG, "AlarmReceiver: Nonzero checksum\n");
+			ast_debug(1, "AlarmReceiver: Nonzero checksum\n");
 			continue;
 		}
 
@@ -572,8 +566,7 @@
 				database_increment("format-errors");
 				if(option_verbose >= 2)
 					ast_verbose(VERBOSE_PREFIX_2 "AlarmReceiver: Wrong message type\n");
-				if (option_debug)
-					ast_log(LOG_DEBUG, "AlarmReceiver: Wrong message type\n");
+				ast_debug(1, "AlarmReceiver: Wrong message type\n");
 			continue;
 			}
 		}
@@ -715,8 +708,7 @@
 	*/
 	
 	if((!res) && (!ast_strlen_zero(event_app)) && (event_head)){
-		if (option_debug)
-			ast_log(LOG_DEBUG,"Alarmreceiver: executing: %s\n", event_app);
+		ast_debug(1,"Alarmreceiver: executing: %s\n", event_app);
 		ast_safe_system(event_app);
 	}
 

Modified: trunk/apps/app_amd.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_amd.c?view=diff&rev=69327&r1=69326&r2=69327
==============================================================================
--- trunk/apps/app_amd.c (original)
+++ trunk/apps/app_amd.c Thu Jun 14 14:39:12 2007
@@ -159,8 +159,9 @@
 			maximumNumberOfWords = atoi(args.argMaximumNumberOfWords);
 		if (!ast_strlen_zero(args.argSilenceThreshold))
 			silenceThreshold = atoi(args.argSilenceThreshold);
-	} else if (option_debug)
-		ast_log(LOG_DEBUG, "AMD using the default parameters.\n");
+	} else {
+		ast_debug(1, "AMD using the default parameters.\n");
+	}
 
 	/* Now we're ready to roll! */
 	if (option_verbose > 2)
@@ -195,8 +196,7 @@
 		if (!(f = ast_read(chan))) {
 			if (option_verbose > 2)
 				ast_verbose(VERBOSE_PREFIX_3 "AMD: HANGUP\n");
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Got hangup\n");
+			ast_debug(1, "Got hangup\n");
 			strcpy(amdStatus, "HANGUP");
 			break;
 		}

Modified: trunk/apps/app_channelredirect.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_channelredirect.c?view=diff&rev=69327&r1=69326&r2=69327
==============================================================================
--- trunk/apps/app_channelredirect.c (original)
+++ trunk/apps/app_channelredirect.c Thu Jun 14 14:39:12 2007
@@ -105,8 +105,7 @@
 		goto chanquit;
 	}
 
-	if (option_debug > 1)
-		ast_log(LOG_DEBUG, "Attempting async goto (%s) to %s|%s|%d\n", args.channel, S_OR(context, chan2->context), S_OR(exten, chan2->exten), prio);
+	ast_debug(2, "Attempting async goto (%s) to %s|%s|%d\n", args.channel, S_OR(context, chan2->context), S_OR(exten, chan2->exten), prio);
 
 	if (ast_async_goto_if_exists(chan2, S_OR(context, chan2->context), S_OR(exten, chan2->exten), prio))
 		ast_log(LOG_WARNING, "%s failed for %s\n", app, args.channel);

Modified: trunk/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_chanspy.c?view=diff&rev=69327&r1=69326&r2=69327
==============================================================================
--- trunk/apps/app_chanspy.c (original)
+++ trunk/apps/app_chanspy.c Thu Jun 14 14:39:12 2007
@@ -378,12 +378,12 @@
 			tmp[0] = res;
 			tmp[1] = '\0';
 			if (!ast_goto_if_exists(chan, exitcontext, tmp, 1)) {
-				ast_log(LOG_DEBUG, "Got DTMF %c, goto context %s\n", tmp[0], exitcontext);
+				ast_debug(1, "Got DTMF %c, goto context %s\n", tmp[0], exitcontext);
 				pbx_builtin_setvar_helper(chan, "SPY_CHANNEL", name);
 				running = -2;
 				break;
-			} else if (option_debug > 1) {
-				ast_log(LOG_DEBUG, "Exit by single digit did not work in chanspy. Extension %s does not exist in context %s\n", tmp, exitcontext);
+			} else {
+				ast_debug(2, "Exit by single digit did not work in chanspy. Extension %s does not exist in context %s\n", tmp, exitcontext);
 			}
 		} else if (res >= '0' && res <= '9') {
 			inp[x++] = res;
@@ -508,8 +508,8 @@
 				tmp[1] = '\0';
 				if (!ast_goto_if_exists(chan, exitcontext, tmp, 1))
 					goto exit;
-				else if (option_debug > 1)
-					ast_log(LOG_DEBUG, "Exit by single digit did not work in chanspy. Extension %s does not exist in context %s\n", tmp, exitcontext);
+				else
+					ast_debug(2, "Exit by single digit did not work in chanspy. Extension %s does not exist in context %s\n", tmp, exitcontext);
 			}
 		}
 
@@ -524,8 +524,8 @@
 			tmp[1] = '\0';
 			if (!ast_goto_if_exists(chan, exitcontext, tmp, 1))
 				goto exit;
-			else if (option_debug > 1)
-				ast_log(LOG_DEBUG, "Exit by single digit did not work in chanspy. Extension %s does not exist in context %s\n", tmp, exitcontext);
+			else
+				ast_debug(2, "Exit by single digit did not work in chanspy. Extension %s does not exist in context %s\n", tmp, exitcontext);
 		}
 				
 		/* reset for the next loop around, unless overridden later */

Modified: trunk/apps/app_db.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_db.c?view=diff&rev=69327&r1=69326&r2=69327
==============================================================================
--- trunk/apps/app_db.c (original)
+++ trunk/apps/app_db.c Thu Jun 14 14:39:12 2007
@@ -78,8 +78,7 @@
 		family = strsep(&argv, "/");
 		keytree = strsep(&argv, "\0");
 			if (!family || !keytree) {
-				if (option_debug)
-					ast_log(LOG_DEBUG, "Ignoring; Syntax error in argument\n");
+				ast_debug(1, "Ignoring; Syntax error in argument\n");
 				ast_module_user_remove(u);
 				return 0;
 			}
@@ -126,8 +125,7 @@
 		family = strsep(&argv, "/");
 		key = strsep(&argv, "\0");
 		if (!family || !key) {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Ignoring; Syntax error in argument\n");
+			ast_debug(1, "Ignoring; Syntax error in argument\n");
 			ast_module_user_remove(u);
 			return 0;
 		}
@@ -138,8 +136,7 @@
 				ast_verbose(VERBOSE_PREFIX_3 "DBdel: Error deleting key from database.\n");
 		}
 	} else {
-		if (option_debug)
-			ast_log(LOG_DEBUG, "Ignoring, no parameters\n");
+		ast_debug(1, "Ignoring, no parameters\n");
 	}
 
 	ast_module_user_remove(u);

Modified: trunk/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_dial.c?view=diff&rev=69327&r1=69326&r2=69327
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Thu Jun 14 14:39:12 2007
@@ -711,8 +711,7 @@
 					}
 					break;
 				default:
-					if (option_debug)
-						ast_log(LOG_DEBUG, "Dunno what to do with control type %d\n", f->subclass);
+					ast_debug(1, "Dunno what to do with control type %d\n", f->subclass);
 				}
 			} else if (single) {
 				/* XXX are we sure the logic is correct ? or we should just switch on f->frametype ? */
@@ -1417,8 +1416,7 @@
 		/* check the results of ast_call */
 		if (res) {
 			/* Again, keep going even if there's an error */
-			if (option_debug)
-				ast_log(LOG_DEBUG, "ast call on peer returned %d\n", res);
+			ast_debug(1, "ast call on peer returned %d\n", res);
 			if (option_verbose > 2)
 				ast_verbose(VERBOSE_PREFIX_3 "Couldn't call %s\n", numsubst);
 			ast_hangup(tc);
@@ -1510,8 +1508,7 @@
 			number = numsubst;
 		pbx_builtin_setvar_helper(chan, "DIALEDPEERNUMBER", number);
  		if (!ast_strlen_zero(args.url) && ast_channel_supports_html(peer) ) {
-			if (option_debug)
- 				ast_log(LOG_DEBUG, "app_dial: sendurl=%s.\n", args.url);
+ 			ast_debug(1, "app_dial: sendurl=%s.\n", args.url);
  			ast_channel_sendurl( peer, args.url );
  		}
 		if ( (ast_test_flag(&opts, OPT_PRIVACY) || ast_test_flag(&opts, OPT_SCREENING)) && pa.privdb_val == AST_PRIVACY_UNKNOWN) {
@@ -1569,8 +1566,7 @@
 			if (theapp && !res) {	/* XXX why check res here ? */
 				replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_MACRO]);
 				res = pbx_exec(peer, theapp, opt_args[OPT_ARG_CALLEE_MACRO]);
-				if (option_debug)
-					ast_log(LOG_DEBUG, "Macro exited with status %d\n", res);
+				ast_debug(1, "Macro exited with status %d\n", res);
 				res = 0;
 			} else {
 				ast_log(LOG_ERROR, "Could not find application Macro\n");
@@ -1706,8 +1702,7 @@
 	hanguptree(outgoing, NULL);
 	pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
 	senddialendevent(chan, pa.status);
-	if (option_debug)
-		ast_log(LOG_DEBUG, "Exiting with DIALSTATUS=%s.\n", pa.status);
+	ast_debug(1, "Exiting with DIALSTATUS=%s.\n", pa.status);
 	
 	if ((ast_test_flag(peerflags, OPT_GO_ON)) && (!chan->_softhangup) && (res != AST_PBX_KEEPALIVE)) {
 		if (calldurationlimit)

Modified: trunk/apps/app_directed_pickup.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_directed_pickup.c?view=diff&rev=69327&r1=69326&r2=69327
==============================================================================
--- trunk/apps/app_directed_pickup.c (original)
+++ trunk/apps/app_directed_pickup.c Thu Jun 14 14:39:12 2007
@@ -59,8 +59,7 @@
 {
 	int res = 0;
 
-	if (option_debug)
-		ast_log(LOG_DEBUG, "Call pickup on '%s' by '%s'\n", target->name, chan->name);
+	ast_debug(1, "Call pickup on '%s' by '%s'\n", target->name, chan->name);
 
 	if ((res = ast_answer(chan))) {
 		ast_log(LOG_WARNING, "Unable to answer '%s'\n", chan->name);

Modified: trunk/apps/app_disa.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_disa.c?view=diff&rev=69327&r1=69326&r2=69327
==============================================================================
--- trunk/apps/app_disa.c (original)
+++ trunk/apps/app_disa.c Thu Jun 14 14:39:12 2007
@@ -164,10 +164,8 @@
 		return -1;
 	}
 	
-	if (option_debug) {
-		ast_log(LOG_DEBUG, "Digittimeout: %d\n", digittimeout);
-		ast_log(LOG_DEBUG, "Responsetimeout: %d\n", firstdigittimeout);
-	}
+	ast_debug(1, "Digittimeout: %d\n", digittimeout);
+	ast_debug(1, "Responsetimeout: %d\n", firstdigittimeout);
 
 	tmp = ast_strdupa(data);
 
@@ -180,8 +178,7 @@
 	if (!ast_strlen_zero(args.options))
 		ast_app_parse_options(app_opts, &flags, NULL, args.options);
 
-	if (option_debug)
-		ast_log(LOG_DEBUG, "Mailbox: %s\n",args.mailbox);
+	ast_debug(1, "Mailbox: %s\n",args.mailbox);
 
 	special_noanswer = 0;
 	if (ast_test_flag(&flags, NOANSWER_FLAG)) {
@@ -196,13 +193,11 @@
 	acctcode[0] = 0;
 	/* can we access DISA without password? */ 
 
-	if (option_debug)
-		ast_log(LOG_DEBUG, "Context: %s\n",args.context);
+	ast_debug(1, "Context: %s\n",args.context);
 
 	if (!strcasecmp(args.passcode, "no-password")) {
 		k |= 1; /* We have the password */
-		if (option_debug)
-			ast_log(LOG_DEBUG, "DISA no-password login success\n");
+		ast_debug(1, "DISA no-password login success\n");
 	}
 	lastdigittime = ast_tvnow();
 
@@ -212,14 +207,12 @@
 		  /* if outa time, give em reorder */
 		if (ast_tvdiff_ms(ast_tvnow(), lastdigittime) > 
 		    ((k&2) ? digittimeout : firstdigittimeout)) {
-			if (option_debug)
-				ast_log(LOG_DEBUG,"DISA %s entry timeout on chan %s\n",
-					((k&1) ? "extension" : "password"),chan->name);
+			ast_debug(1,"DISA %s entry timeout on chan %s\n",
+				((k&1) ? "extension" : "password"),chan->name);
 			break;
 		}
 		if ((res = ast_waitfor(chan, -1) < 0)) {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Waitfor returned %d\n", res);
+			ast_debug(1, "Waitfor returned %d\n", res);
 			continue;
 		}
 			
@@ -280,8 +273,7 @@
 
 							AST_STANDARD_APP_ARGS(args, pwline);
 			
-							if (option_debug)
-								ast_log(LOG_DEBUG, "Mailbox: %s\n",args.mailbox);
+							ast_debug(1, "Mailbox: %s\n",args.mailbox);
 
 							/* password must be in valid format (numeric) */
 							if (sscanf(args.passcode,"%d", &j) < 1)
@@ -304,8 +296,7 @@
 
 					}
 					 /* password good, set to dial state */
-					if (option_debug)
-						ast_log(LOG_DEBUG,"DISA on chan %s password is good\n",chan->name);
+					ast_debug(1,"DISA on chan %s password is good\n",chan->name);
 					play_dialtone(chan, args.mailbox);
 
 					k|=1; /* In number mode */
@@ -313,8 +304,7 @@
 					exten[sizeof(acctcode)] = 0;
 					ast_copy_string(acctcode, exten, sizeof(acctcode));
 					exten[0] = 0;
-					if (option_debug)
-						ast_log(LOG_DEBUG,"Successful DISA log-in on chan %s\n", chan->name);
+					ast_debug(1,"Successful DISA log-in on chan %s\n", chan->name);
 					continue;
 				}
 			}

Modified: trunk/apps/app_festival.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_festival.c?view=diff&rev=69327&r1=69326&r2=69327
==============================================================================
--- trunk/apps/app_festival.c (original)
+++ trunk/apps/app_festival.c Thu Jun 14 14:39:12 2007
@@ -221,8 +221,7 @@
 				break;
 			}
 			if (f->frametype == AST_FRAME_DTMF) {
-				if (option_debug)
-					ast_log(LOG_DEBUG, "User pressed a key\n");
+				ast_debug(1, "User pressed a key\n");
 				if (intkeys && strchr(intkeys, f->subclass)) {
 					res = f->subclass;
 					ast_frfree(f);
@@ -252,15 +251,13 @@
 						break;
 					}
 					if (res < needed) { /* last frame */
-						if (option_debug)
-							ast_log(LOG_DEBUG, "Last frame\n");
+						ast_debug(1, "Last frame\n");
 						res=0;
 						ast_frfree(f);
 						break;
 					}
 				} else {
-					if (option_debug)
-						ast_log(LOG_DEBUG, "No more waveform\n");
+					ast_debug(1, "No more waveform\n");
 					res = 0;
 				}
 			}
@@ -380,8 +377,7 @@
 			intstr = AST_DIGIT_ANY;
 	}
 	
-	if (option_debug)
-		ast_log(LOG_DEBUG, "Text passed to festival server : %s\n",(char *)data);
+	ast_debug(1, "Text passed to festival server : %s\n",(char *)data);
 	/* Connect to local festival server */
 	
 	fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
@@ -440,21 +436,17 @@
     			if (fdesc!=-1) {
     				writecache=1;
     				strln=strlen((char *)data);
-				if (option_debug)
-					ast_log(LOG_DEBUG,"line length : %d\n",strln);
+				ast_debug(1,"line length : %d\n",strln);
     				write(fdesc,&strln,sizeof(int));
     				write(fdesc,data,strln);
 				seekpos=lseek(fdesc,0,SEEK_CUR);
-				if (option_debug)
-					ast_log(LOG_DEBUG,"Seek position : %d\n",seekpos);
+				ast_debug(1,"Seek position : %d\n",seekpos);
     			}
     		} else {
     			read(fdesc,&strln,sizeof(int));
-			if (option_debug)
-				ast_log(LOG_DEBUG,"Cache file exists, strln=%d, strlen=%d\n",strln,(int)strlen((char *)data));
+			ast_debug(1,"Cache file exists, strln=%d, strlen=%d\n",strln,(int)strlen((char *)data));
     			if (strlen((char *)data)==strln) {
-				if (option_debug)
-					ast_log(LOG_DEBUG,"Size OK\n");
+				ast_debug(1,"Size OK\n");
     				read(fdesc,&bigstring,strln);
 	    			bigstring[strln] = 0;
 				if (strcmp(bigstring,data)==0) { 
@@ -471,11 +463,9 @@
 	if (readcache==1) {
 		close(fd);
 		fd=fdesc;
-		if (option_debug)
-			ast_log(LOG_DEBUG,"Reading from cache...\n");
+		ast_debug(1,"Reading from cache...\n");
 	} else {
-		if (option_debug)
-			ast_log(LOG_DEBUG,"Passing text to festival...\n");
+		ast_debug(1,"Passing text to festival...\n");
 		fs=fdopen(dup(fd),"wb");
 		fprintf(fs,festivalcommand,(char *)data);
 		fflush(fs);
@@ -484,8 +474,7 @@
 	
 	/* Write to cache and then pass it down */
 	if (writecache==1) {
-		if (option_debug)
-			ast_log(LOG_DEBUG,"Writing result to cache...\n");
+		ast_debug(1,"Writing result to cache...\n");
 		while ((strln=read(fd,buffer,16384))!=0) {
 			write(fdesc,buffer,strln);
 		}
@@ -495,8 +484,7 @@
 		lseek(fd,seekpos,SEEK_SET);
 	}
 	
-	if (option_debug)
-		ast_log(LOG_DEBUG,"Passing data to channel...\n");
+	ast_debug(1,"Passing data to channel...\n");
 	
 	/* Read back info from server */
 	/* This assumes only one waveform will come back, also LP is unlikely */
@@ -521,16 +509,14 @@
                }
 		ack[3] = '\0';
 		if (strcmp(ack,"WV\n") == 0) {         /* receive a waveform */
-			if (option_debug)
-				ast_log(LOG_DEBUG,"Festival WV command\n");
+			ast_debug(1,"Festival WV command\n");
 			waveform = socket_receive_file_to_buff(fd,&filesize);
 			res = send_waveform_to_channel(chan,waveform,filesize, intstr);
 			ast_free(waveform);
 			break;
 		}
 		else if (strcmp(ack,"LP\n") == 0) {   /* receive an s-expr */
-			if (option_debug)
-				ast_log(LOG_DEBUG,"Festival LP command\n");
+			ast_debug(1,"Festival LP command\n");
 			waveform = socket_receive_file_to_buff(fd,&filesize);
 			waveform[filesize]='\0';
 			ast_log(LOG_WARNING,"Festival returned LP : %s\n",waveform);

Modified: trunk/apps/app_followme.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_followme.c?view=diff&rev=69327&r1=69326&r2=69327
==============================================================================
--- trunk/apps/app_followme.c (original)
+++ trunk/apps/app_followme.c Thu Jun 14 14:39:12 2007
@@ -269,8 +269,7 @@
 		*tmp = '\0';
 	ast_copy_string(cur->number, number, sizeof(cur->number));
 	cur->order = numorder;
-	if (option_debug)
-		ast_log(LOG_DEBUG, "Created a number, %s, order of , %d, with a timeout of %ld.\n", cur->number, cur->order, cur->timeout);
+	ast_debug(1, "Created a number, %s, order of , %d, with a timeout of %ld.\n", cur->number, cur->order, cur->timeout);
 
 	return cur;
 }
@@ -356,8 +355,7 @@
 			if (!strcasecmp(f->name, cat))
 				break;
 		}
-		if (option_debug)
-			ast_log(LOG_DEBUG, "New profile %s.\n", cat);
+		ast_debug(1, "New profile %s.\n", cat);
 		if (!f) {
 			/* Make one then */
 			f = alloc_profile(cat);
@@ -406,8 +404,7 @@
 					AST_LIST_INSERT_TAIL(&f->numbers, cur, entry);
 				} else {
 					profile_set_param(f, var->name, var->value, var->lineno, 1);
-					if (option_debug > 1)
-						ast_log(LOG_DEBUG, "Logging parameter %s with value %s from lineno %d\n", var->name, var->value, var->lineno);
+					ast_debug(2, "Logging parameter %s with value %s from lineno %d\n", var->name, var->value, var->lineno);
 				}
 				var = var->next;
 			} /* End while(var) loop */
@@ -688,8 +685,7 @@
 								ast_verbose( VERBOSE_PREFIX_3 "%s stopped sounds\n", winner->name);
 							break;
 						default:
-							if (option_debug)
-								ast_log(LOG_DEBUG, "Dunno what to do with control type %d\n", f->subclass);
+							ast_debug(1, "Dunno what to do with control type %d\n", f->subclass);
 							break;
 						}
 					} 
@@ -697,24 +693,19 @@
 						if (winner->stream)
 							ast_stopstream(winner);
 						tmpuser->digts = 0;
-						if (option_debug)
-							ast_log(LOG_DEBUG, "DTMF received: %c\n",(char) f->subclass);
+						ast_debug(1, "DTMF received: %c\n",(char) f->subclass);
 						tmpuser->yn[tmpuser->ynidx] = (char) f->subclass;
 						tmpuser->ynidx++;
-						if (option_debug)
-							ast_log(LOG_DEBUG, "DTMF string: %s\n", tmpuser->yn);
+						ast_debug(1, "DTMF string: %s\n", tmpuser->yn);
 						if (tmpuser->ynidx >= ynlongest) {
-							if (option_debug)
-								ast_log(LOG_DEBUG, "reached longest possible match - doing evals\n");
+							ast_debug(1, "reached longest possible match - doing evals\n");
 							if (!strcmp(tmpuser->yn, tpargs->takecall)) {
-								if (option_debug)
-									ast_log(LOG_DEBUG, "Match to take the call!\n");
+								ast_debug(1, "Match to take the call!\n");
 								ast_frfree(f);
 								return tmpuser->ochan;	
 							}
 							if (!strcmp(tmpuser->yn, tpargs->nextindp)) {
-								if (option_debug)
-									ast_log(LOG_DEBUG, "Next in dial plan step requested.\n");
+								ast_debug(1, "Next in dial plan step requested.\n");
 								*status = 1;
 								ast_frfree(f);
 								return NULL;
@@ -726,8 +717,7 @@
 					ast_frfree(f);
 				} else {
 					if (winner) {
-						if (option_debug)
-							ast_log(LOG_DEBUG, "we didn't get a frame. hanging up. dg is %d\n",dg);					      
+						ast_debug(1, "we didn't get a frame. hanging up. dg is %d\n",dg);					      
 						if (!dg) {
 							clear_calling_tree(findme_user_list);
 							return NULL;
@@ -735,8 +725,7 @@
 							tmpuser->state = -1;
 						 	ast_hangup(winner);  
 							livechannels--;
-							if (option_debug)
-								ast_log(LOG_DEBUG, "live channels left %d\n", livechannels);
+							ast_debug(1, "live channels left %d\n", livechannels);
 							if (!livechannels) {
 								if (option_verbose > 2)
 									ast_verbose(VERBOSE_PREFIX_3 "no live channels left. exiting.\n");
@@ -747,8 +736,7 @@
 				}					
 				
 			} else
-				if (option_debug)
-					ast_log(LOG_DEBUG, "timed out waiting for action\n");
+				ast_debug(1, "timed out waiting for action\n");
 		}
 		
 	} else {
@@ -793,13 +781,11 @@
 
 	while (nm) {
 
-		if (option_debug > 1)	
-			ast_log(LOG_DEBUG, "Number %s timeout %ld\n", nm->number,nm->timeout);
+		ast_debug(2, "Number %s timeout %ld\n", nm->number,nm->timeout);
 		time(&start_time);
 
 		number = ast_strdupa(nm->number);
-		if (option_debug > 2)
-			ast_log(LOG_DEBUG, "examining %s\n", number);
+		ast_debug(3, "examining %s\n", number);
 		do {
 			rest = strchr(number, '&');
 			if (rest) {
@@ -948,8 +934,7 @@
 	}
 	AST_LIST_UNLOCK(&followmes);
 
-	if (option_debug)
-		ast_log(LOG_DEBUG, "New profile %s.\n", args.followmeid);
+	ast_debug(1, "New profile %s.\n", args.followmeid);
 	if (!f) { 
 		ast_log(LOG_WARNING, "Profile requested, %s, not found in the configuration.\n", args.followmeid);
 		res = 0;

Modified: trunk/apps/app_ices.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_ices.c?view=diff&rev=69327&r1=69326&r2=69327
==============================================================================
--- trunk/apps/app_ices.c (original)
+++ trunk/apps/app_ices.c Thu Jun 14 14:39:12 2007
@@ -170,15 +170,13 @@
 			/* Wait for audio, and stream */
 			ms = ast_waitfor(chan, -1);
 			if (ms < 0) {
-				if (option_debug)
-					ast_log(LOG_DEBUG, "Hangup detected\n");
+				ast_debug(1, "Hangup detected\n");
 				res = -1;
 				break;
 			}
 			f = ast_read(chan);
 			if (!f) {
-				if (option_debug)
-					ast_log(LOG_DEBUG, "Null frame == hangup() detected\n");
+				ast_debug(1, "Null frame == hangup() detected\n");
 				res = -1;
 				break;
 			}

Modified: trunk/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_macro.c?view=diff&rev=69327&r1=69326&r2=69327
==============================================================================
--- trunk/apps/app_macro.c (original)
+++ trunk/apps/app_macro.c Thu Jun 14 14:39:12 2007
@@ -220,8 +220,7 @@
 
 	/* If we are to run the macro exclusively, take the mutex */
 	if (exclusive) {
-		if (option_debug)
-			ast_log(LOG_DEBUG, "Locking macrolock for '%s'\n", fullmacro);
+		ast_debug(1, "Locking macrolock for '%s'\n", fullmacro);
 		ast_autoservice_start(chan);
 		if (ast_context_lockmacro(fullmacro)) {
 			ast_log(LOG_WARNING, "Failed to lock macro '%s' as in-use\n", fullmacro);
@@ -313,8 +312,7 @@
 			if (((res >= '0') && (res <= '9')) || ((res >= 'A') && (res <= 'F')) ||
 		    	(res == '*') || (res == '#')) {
 				/* Just return result as to the previous application as if it had been dialed */
-				if (option_debug)
-					ast_log(LOG_DEBUG, "Oooh, got something to jump out with ('%c')!\n", res);
+				ast_debug(1, "Oooh, got something to jump out with ('%c')!\n", res);
 				break;
 			}
 			switch(res) {
@@ -322,27 +320,25 @@
 				res = 0;
 				goto out;
 			case AST_PBX_KEEPALIVE:
-				if (option_debug)
-					ast_log(LOG_DEBUG, "Spawn extension (%s,%s,%d) exited KEEPALIVE in macro %s on '%s'\n", chan->context, chan->exten, chan->priority, macro, chan->name);
-				else if (option_verbose > 1)
+				ast_debug(2, "Spawn extension (%s,%s,%d) exited KEEPALIVE in macro %s on '%s'\n", chan->context, chan->exten, chan->priority, macro, chan->name);
+				if (option_verbose > 1)
 					ast_verbose( VERBOSE_PREFIX_2 "Spawn extension (%s, %s, %d) exited KEEPALIVE in macro '%s' on '%s'\n", chan->context, chan->exten, chan->priority, macro, chan->name);
 				goto out;
 				break;
 			default:
-				if (option_debug)
-					ast_log(LOG_DEBUG, "Spawn extension (%s,%s,%d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);
-				else if (option_verbose > 1)
+				ast_debug(2, "Spawn extension (%s,%s,%d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);
+				if (option_verbose > 1)
 					ast_verbose( VERBOSE_PREFIX_2 "Spawn extension (%s, %s, %d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);
 				dead = 1;
 				goto out;
 			}
 		}
 
-		ast_log(LOG_DEBUG, "Executed application: %s\n", runningapp);
+		ast_debug(1, "Executed application: %s\n", runningapp);
 
 		if (!strcasecmp(runningapp, "GOSUB")) {
 			gosub_level++;
-			ast_log(LOG_DEBUG, "Incrementing gosub_level\n");
+			ast_debug(1, "Incrementing gosub_level\n");
 		} else if (!strcasecmp(runningapp, "GOSUBIF")) {
 			char tmp2[1024] = "", *cond, *app, *app2 = tmp2;
 			pbx_substitute_variables_helper(chan, runningdata, tmp2, sizeof(tmp2) - 1);
@@ -351,20 +347,20 @@
 			if (pbx_checkcondition(cond)) {
 				if (!ast_strlen_zero(app)) {
 					gosub_level++;
-					ast_log(LOG_DEBUG, "Incrementing gosub_level\n");
+					ast_debug(1, "Incrementing gosub_level\n");
 				}
 			} else {
 				if (!ast_strlen_zero(app2)) {
 					gosub_level++;
-					ast_log(LOG_DEBUG, "Incrementing gosub_level\n");
+					ast_debug(1, "Incrementing gosub_level\n");
 				}
 			}
 		} else if (!strcasecmp(runningapp, "RETURN")) {
 			gosub_level--;
-			ast_log(LOG_DEBUG, "Decrementing gosub_level\n");
+			ast_debug(1, "Decrementing gosub_level\n");
 		} else if (!strcasecmp(runningapp, "STACKPOP")) {
 			gosub_level--;
-			ast_log(LOG_DEBUG, "Decrementing gosub_level\n");
+			ast_debug(1, "Decrementing gosub_level\n");
 		} else if (!strncasecmp(runningapp, "EXEC", 4)) {
 			/* Must evaluate args to find actual app */
 			char tmp2[1024] = "", *tmp3 = NULL;
@@ -379,17 +375,17 @@
 				tmp3 = tmp2;
 
 			if (tmp3)
-				ast_log(LOG_DEBUG, "Last app: %s\n", tmp3);
+				ast_debug(1, "Last app: %s\n", tmp3);
 
 			if (tmp3 && !strncasecmp(tmp3, "GOSUB", 5)) {
 				gosub_level++;
-				ast_log(LOG_DEBUG, "Incrementing gosub_level\n");
+				ast_debug(1, "Incrementing gosub_level\n");
 			} else if (tmp3 && !strncasecmp(tmp3, "RETURN", 6)) {
 				gosub_level--;
-				ast_log(LOG_DEBUG, "Decrementing gosub_level\n");
+				ast_debug(1, "Decrementing gosub_level\n");
 			} else if (tmp3 && !strncasecmp(tmp3, "STACKPOP", 8)) {
 				gosub_level--;
-				ast_log(LOG_DEBUG, "Decrementing gosub_level\n");
+				ast_debug(1, "Decrementing gosub_level\n");
 			}
 		}
 
@@ -401,9 +397,7 @@
 
 		/* don't stop executing extensions when we're in "h" */
 		if (chan->_softhangup && !inhangup) {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Extension %s, macroexten %s, priority %d returned normally even though call was hung up\n",
-					chan->exten, chan->macroexten, chan->priority);
+			ast_debug(1, "Extension %s, macroexten %s, priority %d returned normally even though call was hung up\n", chan->exten, chan->macroexten, chan->priority);
 			goto out;
 		}
 		chan->priority++;
@@ -474,8 +468,7 @@
 
 	/* Unlock the macro */
 	if (exclusive) {
-		if (option_debug)
-			ast_log(LOG_DEBUG, "Unlocking macrolock for '%s'\n", fullmacro);
+		ast_debug(1, "Unlocking macrolock for '%s'\n", fullmacro);
 		if (ast_context_unlockmacro(fullmacro)) {
 			ast_log(LOG_ERROR, "Failed to unlock macro '%s' - that isn't good\n", fullmacro);
 			res = 0;

Modified: trunk/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_meetme.c?view=diff&rev=69327&r1=69326&r2=69327
==============================================================================
--- trunk/apps/app_meetme.c (original)
+++ trunk/apps/app_meetme.c Thu Jun 14 14:39:12 2007
@@ -948,8 +948,7 @@
 	} else 
 		return RESULT_SHOWUSAGE;
 
-	if (option_debug)
-		ast_log(LOG_DEBUG, "Cmdline: %s\n", cmdline);
+	ast_debug(1, "Cmdline: %s\n", cmdline);
 
 	admin_exec(NULL, cmdline);
 
@@ -1325,7 +1324,7 @@
 	AST_RWLIST_UNLOCK(&sla_stations);
 
 	if (!trunk_ref) {
-		ast_log(LOG_DEBUG, "Trunk not found for event!\n");
+		ast_debug(1, "Trunk not found for event!\n");
 		return;
 	}
 
@@ -1616,8 +1615,7 @@
 	if (ztc.confmode) {
 		/* Whoa, already in a conference...  Retry... */
 		if (!retryzap) {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Zap channel is in a conference already, retrying with pseudo\n");
+			ast_debug(1, "Zap channel is in a conference already, retrying with pseudo\n");
 			retryzap = 1;
 			goto zapretry;
 		}
@@ -1651,8 +1649,7 @@
 		ast_mutex_unlock(&conf->playlock);
 		goto outrun;
 	}
-	if (option_debug)
-		ast_log(LOG_DEBUG, "Placed channel %s in ZAP conf %d\n", chan->name, conf->zapconf);
+	ast_debug(1, "Placed channel %s in ZAP conf %d\n", chan->name, conf->zapconf);
 
 	if (!sent_event) {
 		manager_event(EVENT_FLAG_CALL, "MeetmeJoin", 
@@ -1891,8 +1888,7 @@
 						close(fd);
 						using_pseudo = 0;
 					}
-					if (option_debug)
-						ast_log(LOG_DEBUG, "Ooh, something swapped out under us, starting over\n");
+					ast_debug(1, "Ooh, something swapped out under us, starting over\n");
 					retryzap = strcasecmp(c->tech->type, "Zap");
 					user->zapchannel = !retryzap;
 					goto zapretry;
@@ -1959,13 +1955,13 @@
 					tmp[0] = f->subclass;
 					tmp[1] = '\0';
 					if (!ast_goto_if_exists(chan, exitcontext, tmp, 1)) {
-						if (option_debug)
-							ast_log(LOG_DEBUG, "Got DTMF %c, goto context %s\n", tmp[0], exitcontext);
+						ast_debug(1, "Got DTMF %c, goto context %s\n", tmp[0], exitcontext);
 						ret = 0;
 						ast_frfree(f);
 						break;
-					} else if (option_debug > 1)
-						ast_log(LOG_DEBUG, "Exit by single digit did not work in meetme. Extension %s does not exist in context %s\n", tmp, exitcontext);
+					} else {
+						ast_debug(2, "Exit by single digit did not work in meetme. Extension %s does not exist in context %s\n", tmp, exitcontext);
+					}
 				} else if ((f->frametype == AST_FRAME_DTMF) && (f->subclass == '#') && (confflags & CONFFLAG_POUNDEXIT)) {
 					ret = 0;
 					ast_frfree(f);
@@ -2372,8 +2368,7 @@
 	if (!cnf) {
 		if (dynamic) {
 			/* No need to parse meetme.conf */
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Building dynamic conference '%s'\n", confno);
+			ast_debug(1, "Building dynamic conference '%s'\n", confno);
 			if (dynamic_pin) {
 				if (dynamic_pin[0] == 'q') {
 					/* Query the user to enter a PIN */
@@ -2409,7 +2404,7 @@
 				}
 			}
 			if (!var) {
-				ast_log(LOG_DEBUG, "%s isn't a valid conference\n", confno);
+				ast_debug(1, "%s isn't a valid conference\n", confno);
 			}
 			ast_config_destroy(cfg);
 		}
@@ -3484,8 +3479,7 @@
 			ringing_trunk = sla_choose_ringing_trunk(ringing_station->station, &s_trunk_ref, 1);
 			ast_mutex_unlock(&sla.lock);
 			if (!ringing_trunk) {
-				ast_log(LOG_DEBUG, "Found no ringing trunk for station '%s' to answer!\n",
-					ringing_station->station->name);
+				ast_debug(1, "Found no ringing trunk for station '%s' to answer!\n", ringing_station->station->name);
 				break;
 			}
 			/* Track the channel that answered this trunk */
@@ -4260,7 +4254,7 @@
 		ast_cond_destroy(&cond);
 		ast_autoservice_stop(chan);
 		if (!trunk_ref->trunk->chan) {
-			ast_log(LOG_DEBUG, "Trunk didn't get created. chan: %lx\n", (long) trunk_ref->trunk->chan);
+			ast_debug(1, "Trunk didn't get created. chan: %lx\n", (long) trunk_ref->trunk->chan);
 			pbx_builtin_setvar_helper(chan, "SLASTATION_STATUS", "CONGESTION");
 			sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL);
 			trunk_ref->chan = NULL;

Modified: trunk/apps/app_minivm.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_minivm.c?view=diff&rev=69327&r1=69326&r2=69327
==============================================================================
--- trunk/apps/app_minivm.c (original)
+++ trunk/apps/app_minivm.c Thu Jun 14 14:39:12 2007
@@ -506,8 +506,7 @@
 	}
 
 	while (var) {
-		if (option_debug > 2)
-			ast_log(LOG_DEBUG, "-_-_- Configuring template option %s = \"%s\" for template %s\n", var->name, var->value, name);
+		ast_debug(3, "-_-_- Configuring template option %s = \"%s\" for template %s\n", var->name, var->value, name);
 		if (!strcasecmp(var->name, "fromaddress")) {
 			ast_copy_string(template->fromaddress, var->value, sizeof(template->fromaddress));
 		} else if (!strcasecmp(var->name, "fromemail")) {
@@ -823,8 +822,7 @@
 		ast_log(LOG_NOTICE, "No username or domain? \n");
 		return NULL;
 	}
-	if (option_debug > 2)
-		ast_log(LOG_DEBUG, "-_-_-_- Looking for voicemail user %s in domain %s\n", username, domain);
+	ast_debug(3, "-_-_-_- Looking for voicemail user %s in domain %s\n", username, domain);
 
 	AST_LIST_LOCK(&minivm_accounts);
 	AST_LIST_TRAVERSE(&minivm_accounts, cur, list) {
@@ -835,8 +833,7 @@
 	AST_LIST_UNLOCK(&minivm_accounts);
 
 	if (cur) {
-		if (option_debug > 2)
-			ast_log(LOG_DEBUG, "-_-_- Found account for %s@%s\n", username, domain);
+		ast_debug(3, "-_-_- Found account for %s@%s\n", username, domain);
 		vmu = cur;
 
 	} else
@@ -849,8 +846,7 @@
 		if (vmu) {
 			ast_copy_string(vmu->username, username, sizeof(vmu->username));
 			ast_copy_string(vmu->domain, domain, sizeof(vmu->domain));
-			if (option_debug)
-				ast_log(LOG_DEBUG, "--- Created temporary account\n");
+			ast_debug(1, "--- Created temporary account\n");
 		}
 
 	}
@@ -926,8 +922,7 @@
 		return -1;	
 	}
 
-	if (option_debug > 2)
-		ast_log(LOG_DEBUG, "-_-_- Sending mail to %s@%s - Using template %s\n", vmu->username, vmu->domain, template->name);
+	ast_debug(3, "-_-_- Sending mail to %s@%s - Using template %s\n", vmu->username, vmu->domain, template->name);
 
 	if (!strcmp(format, "wav49"))
 		format = "WAV";
@@ -940,8 +935,7 @@
 		int tmpfd;
 
 		snprintf(newtmp, sizeof(newtmp), "/tmp/XXXXXX");
-		if (option_debug > 2)
-			ast_log(LOG_DEBUG, "newtmp: %s\n", newtmp);
+		ast_debug(3, "newtmp: %s\n", newtmp);
 		tmpfd = mkstemp(newtmp);
 		snprintf(tmpcmd, sizeof(tmpcmd), "sox -v %.4f %s.%s %s.%s", vmu->volgain, filename, format, newtmp, format);
 		ast_safe_system(tmpcmd);
@@ -955,8 +949,8 @@
 	/* Create file name */
 	snprintf(fname, sizeof(fname), "%s.%s", finalfilename, format);
 
-	if (option_debug && template->attachment)
-		ast_log(LOG_DEBUG, "-- Attaching file '%s', format '%s', uservm is '%d'\n", finalfilename, format, attach_user_voicemail);
+	if (template->attachment)
+		ast_debug(1, "-- Attaching file '%s', format '%s', uservm is '%d'\n", finalfilename, format, attach_user_voicemail);
 
 	/* Make a temporary file instead of piping directly to sendmail, in case the mail
 	   command hangs */
@@ -967,8 +961,7 @@
 			close(pfd);
 			pfd = -1;
 		}
-		if (option_debug)
-			ast_log(LOG_DEBUG, "-_-_- Opening temp file for e-mail: %s\n", tmp);
+		ast_debug(1, "-_-_- Opening temp file for e-mail: %s\n", tmp);
 	}
 	if (!p) {
 		ast_log(LOG_WARNING, "Unable to open temporary file '%s'\n", tmp);
@@ -1029,8 +1022,7 @@
 	if (ast_strlen_zero(fromaddress)) {
 		fprintf(p, "From: Asterisk PBX <%s>\n", who);
 	} else {
-		if (option_debug > 3)
-			ast_log(LOG_DEBUG, "-_-_- Fromaddress template: %s\n", fromaddress);
+		ast_debug(4, "-_-_- Fromaddress template: %s\n", fromaddress);
 		/* Allocate a buffer big enough for variable substitution */
 		int vmlen = strlen(fromaddress) * 3 + 200;
 
@@ -1046,8 +1038,7 @@
 			return -1;	
 		}
 	} 
-	if (option_debug > 3)
-		ast_log(LOG_DEBUG, "-_-_- Fromstring now: %s\n", ast_strlen_zero(passdata) ? "-default-" : passdata);
+	ast_debug(4, "-_-_- Fromstring now: %s\n", ast_strlen_zero(passdata) ? "-default-" : passdata);
 
 	fprintf(p, "Message-ID: <Asterisk-%d-%s-%d-%s>\n", (unsigned int)rand(), vmu->username, getpid(), who);
 	len_passdata = strlen(vmu->fullname) * 2 + 3;
@@ -1069,11 +1060,12 @@
 			fclose(p);
 			return -1;	
 		}
-		if (option_debug > 3)

[... 12998 lines stripped ...]


More information about the asterisk-commits mailing list