[asterisk-commits] russell: trunk r71338 - in /trunk: apps/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Jun 24 13:51:42 CDT 2007


Author: russell
Date: Sun Jun 24 13:51:41 2007
New Revision: 71338

URL: http://svn.digium.com/view/asterisk?view=rev&rev=71338
Log:
Conversions to ast_debug()
(issue #9984, patches from eliel and dimas)

Modified:
    trunk/apps/app_meetme.c
    trunk/apps/app_minivm.c
    trunk/apps/app_rpt.c
    trunk/apps/app_skel.c
    trunk/apps/app_test.c
    trunk/main/http.c
    trunk/main/io.c
    trunk/main/jitterbuf.c
    trunk/main/loader.c
    trunk/main/logger.c
    trunk/main/manager.c
    trunk/main/rtp.c
    trunk/main/say.c
    trunk/main/sched.c
    trunk/main/translate.c
    trunk/main/udptl.c

Modified: trunk/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_meetme.c?view=diff&rev=71338&r1=71337&r2=71338
==============================================================================
--- trunk/apps/app_meetme.c (original)
+++ trunk/apps/app_meetme.c Sun Jun 24 13:51:41 2007
@@ -2165,8 +2165,8 @@
 					}
 				} else if (f->frametype == AST_FRAME_NULL) {
 					/* Ignore NULL frames. It is perfectly normal to get these if the person is muted. */
-				} else if (option_debug) {
-					ast_log(LOG_DEBUG,
+				} else {
+					ast_debug(1, 
 						"Got unrecognized frame on channel %s, f->frametype=%d,f->subclass=%d\n",
 						chan->name, f->frametype, f->subclass);
 				}

Modified: trunk/apps/app_minivm.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_minivm.c?view=diff&rev=71338&r1=71337&r2=71338
==============================================================================
--- trunk/apps/app_minivm.c (original)
+++ trunk/apps/app_minivm.c Sun Jun 24 13:51:41 2007
@@ -941,8 +941,7 @@
 		snprintf(tmpcmd, sizeof(tmpcmd), "sox -v %.4f %s.%s %s.%s", vmu->volgain, filename, format, newtmp, format);
 		ast_safe_system(tmpcmd);
 		finalfilename = newtmp;
-		if (option_debug > 2)
-			ast_log	(LOG_DEBUG, "-- VOLGAIN: Stored at: %s.%s - Level: %.4f - Mailbox: %s\n", filename, format, vmu->volgain, vmu->username);
+		ast_debug(3, "-- VOLGAIN: Stored at: %s.%s - Level: %.4f - Mailbox: %s\n", filename, format, vmu->volgain, vmu->username);
 	} else {
 		finalfilename = ast_strdupa(filename);
 	}

Modified: trunk/apps/app_rpt.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_rpt.c?view=diff&rev=71338&r1=71337&r2=71338
==============================================================================
--- trunk/apps/app_rpt.c (original)
+++ trunk/apps/app_rpt.c Sun Jun 24 13:51:41 2007
@@ -805,8 +805,8 @@
 	{"ilink", function_ilink},
 	{"status", function_status},
 	{"remote", function_remote},
-	{"macro", function_macro}
-	{"gosub", function_gosub}
+	{"macro", function_macro},
+	{"gosub", function_gosub},
 } ;
 
 /*

Modified: trunk/apps/app_skel.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_skel.c?view=diff&rev=71338&r1=71337&r2=71338
==============================================================================
--- trunk/apps/app_skel.c (original)
+++ trunk/apps/app_skel.c Sun Jun 24 13:51:41 2007
@@ -127,7 +127,10 @@
 
 static int load_module(void)
 {
-	return ast_register_application(app, app_exec, synopsis, descrip);
+	if (ast_register_application(app, app_exec, synopsis, descrip))
+		return AST_MODULE_LOAD_DECLINE;
+
+	return AST_MODULE_LOAD_SUCCESS;
 }
 
 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Skeleton (sample) Application");

Modified: trunk/apps/app_test.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_test.c?view=diff&rev=71338&r1=71337&r2=71338
==============================================================================
--- trunk/apps/app_test.c (original)
+++ trunk/apps/app_test.c Sun Jun 24 13:51:41 2007
@@ -283,7 +283,7 @@
 				else
 					res = -1;
 			}
-			if (option_debug && !res ) {
+			if (!res) {
 				/* Step 12: Hangup! */
 				ast_debug(1, "TestClient: 12.  Hangup\n");
 			}

Modified: trunk/main/http.c
URL: http://svn.digium.com/view/asterisk/trunk/main/http.c?view=diff&rev=71338&r1=71337&r2=71338
==============================================================================
--- trunk/main/http.c (original)
+++ trunk/main/http.c Sun Jun 24 13:51:41 2007
@@ -338,7 +338,7 @@
 	struct ast_http_post_mapping *post_map;
 
 	if (!ast_strlen_zero(prefix) && strncmp(prefix, uri, strlen(prefix))) {
-		ast_log(LOG_DEBUG, "URI %s does not have prefix %s\n", uri, prefix);
+		ast_debug(1, "URI %s does not have prefix %s\n", uri, prefix);
 		return NULL;
 	}
 
@@ -377,8 +377,7 @@
 
 	snprintf(filename, sizeof(filename), "%s/%s", post_dir, fn);
 
-	if (option_debug)
-		ast_log(LOG_DEBUG, "Posting raw data to %s\n", filename);
+	ast_debug(1, "Posting raw data to %s\n", filename);
 
 	if (!(f = fopen(filename, "w"))) {
 		ast_log(LOG_WARNING, "Unable to open %s for writing file from a POST!\n", filename);
@@ -386,15 +385,13 @@
 	}
 
 	if (!(body = mm_mimepart_getbody(part, 0))) {
-		if (option_debug)
-			ast_log(LOG_DEBUG, "Couldn't get the mimepart body\n");
+		ast_debug(1, "Couldn't get the mimepart body\n");
 		fclose(f);
 		return;
 	}
 	body_len = mm_mimepart_getlength(part);
 
-	if (option_debug)
-		ast_log(LOG_DEBUG, "Body length is %ld\n", (long int)body_len);
+	ast_debug(1, "Body length is %ld\n", (long int)body_len);
 
 	fwrite(body, 1, body_len, f);
 
@@ -450,8 +447,7 @@
 				fclose(f);
 				return NULL;
 			}
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Got a Content-Length of %d\n", content_len);
+			ast_debug(1, "Got a Content-Length of %d\n", content_len);
 		} else if (!strcasecmp(var->name, "Content-Type"))
 			fprintf(f, "Content-Type: %s\r\n\r\n", var->value);
 	}
@@ -464,16 +460,14 @@
 	}
 
 	if (fseek(f, SEEK_SET, 0)) {
-		if (option_debug)
-			ast_log(LOG_DEBUG, "Failed to seek temp file back to beginning.\n");
+		ast_debug(1, "Failed to seek temp file back to beginning.\n");
 		fclose(f);
 		return NULL;
 	}
 
 	AST_RWLIST_RDLOCK(&post_mappings);
 	if (!(post_map = find_post_mapping(uri))) {
-		if (option_debug)
-			ast_log(LOG_DEBUG, "%s is not a valid URI for POST\n", uri);
+		ast_debug(1, "%s is not a valid URI for POST\n", uri);
 		AST_RWLIST_UNLOCK(&post_mappings);
 		fclose(f);
 		*status = 404;
@@ -484,8 +478,7 @@
 	post_map = NULL;
 	AST_RWLIST_UNLOCK(&post_mappings);
 
-	if (option_debug)
-		ast_log(LOG_DEBUG, "Going to post files to dir %s\n", post_dir);
+	ast_debug(1, "Going to post files to dir %s\n", post_dir);
 
 	if (!(ctx = mm_context_new())) {
 		fclose(f);
@@ -513,9 +506,9 @@
 
 	if (option_debug) {
 		if (mm_context_iscomposite(ctx))
-			ast_log(LOG_DEBUG, "Found %d MIME parts\n", mm_res - 1);
+			ast_debug(1, "Found %d MIME parts\n", mm_res - 1);
 		else
-			ast_log(LOG_DEBUG, "We have a flat (not multi-part) message\n");
+			ast_debug(1, "We have a flat (not multi-part) message\n");
 	}
 
 	for (i = 1; i < mm_res; i++) {
@@ -523,20 +516,17 @@
 		char fn[PATH_MAX];
 
 		if (!(part = mm_context_getpart(ctx, i))) {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Failed to get mime part num %d\n", i);
+			ast_debug(1, "Failed to get mime part num %d\n", i);
 			continue;
 		}
 
 		if (get_filename(part, fn, sizeof(fn))) {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Failed to retrieve a filename for part num %d\n", i);
+			ast_debug(1, "Failed to retrieve a filename for part num %d\n", i);
 			continue;
 		}
 	
 		if (!part->type) {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "This part has no content struct?\n");
+			ast_debug(1, "This part has no content struct?\n");
 			continue;
 		}
 
@@ -979,8 +969,7 @@
 	
 	/* Do nothing if nothing has changed */
 	if (!memcmp(&desc->oldsin, &desc->sin, sizeof(desc->oldsin))) {
-		if (option_debug)
-			ast_log(LOG_DEBUG, "Nothing changed in %s\n", desc->name);
+		ast_debug(1, "Nothing changed in %s\n", desc->name);
 		return;
 	}
 	

Modified: trunk/main/io.c
URL: http://svn.digium.com/view/asterisk/trunk/main/io.c?view=diff&rev=71338&r1=71337&r2=71338
==============================================================================
--- trunk/main/io.c (original)
+++ trunk/main/io.c Sun Jun 24 13:51:41 2007
@@ -37,6 +37,7 @@
 #include "asterisk/io.h"
 #include "asterisk/logger.h"
 #include "asterisk/utils.h"
+#include "asterisk/options.h"
 
 #ifdef DEBUG_IO
 #define DEBUG DEBUG_M
@@ -119,7 +120,7 @@
 {
 	void *tmp;
 
-	DEBUG(ast_log(LOG_DEBUG, "io_grow()\n"));
+	DEBUG(ast_debug(1, "io_grow()\n"));
 
 	ioc->maxfdcnt += GROW_SHRINK_SIZE;
 
@@ -159,7 +160,7 @@
 {
 	int *ret;
 
-	DEBUG(ast_log(LOG_DEBUG, "ast_io_add()\n"));
+	DEBUG(ast_debug(1, "ast_io_add()\n"));
 
 	if (ioc->fdcnt >= ioc->maxfdcnt) {
 		/* 
@@ -275,7 +276,7 @@
 {
 	int res, x, origcnt;
 
-	DEBUG(ast_log(LOG_DEBUG, "ast_io_wait()\n"));
+	DEBUG(ast_debug(1, "ast_io_wait()\n"));
 
 	if ((res = poll(ioc->fds, ioc->fdcnt, howlong)) <= 0)
 		return res;
@@ -312,19 +313,19 @@
 	 */
 	int x;
 
-	ast_log(LOG_DEBUG, "Asterisk IO Dump: %d entries, %d max entries\n", ioc->fdcnt, ioc->maxfdcnt);
-	ast_log(LOG_DEBUG, "================================================\n");
-	ast_log(LOG_DEBUG, "| ID    FD     Callback    Data        Events  |\n");
-	ast_log(LOG_DEBUG, "+------+------+-----------+-----------+--------+\n");
+	ast_debug(1, "Asterisk IO Dump: %d entries, %d max entries\n", ioc->fdcnt, ioc->maxfdcnt);
+	ast_debug(1, "================================================\n");
+	ast_debug(1, "| ID    FD     Callback    Data        Events  |\n");
+	ast_debug(1, "+------+------+-----------+-----------+--------+\n");
 	for (x = 0; x < ioc->fdcnt; x++) {
-		ast_log(LOG_DEBUG, "| %.4d | %.4d | %p | %p | %.6x |\n", 
+		ast_debug(1, "| %.4d | %.4d | %p | %p | %.6x |\n", 
 				*ioc->ior[x].id,
 				ioc->fds[x].fd,
 				ioc->ior[x].callback,
 				ioc->ior[x].data,
 				ioc->fds[x].events);
 	}
-	ast_log(LOG_DEBUG, "================================================\n");
+	ast_debug(1, "================================================\n");
 }
 
 /* Unrelated I/O functions */

Modified: trunk/main/jitterbuf.c
URL: http://svn.digium.com/view/asterisk/trunk/main/jitterbuf.c?view=diff&rev=71338&r1=71337&r2=71338
==============================================================================
--- trunk/main/jitterbuf.c (original)
+++ trunk/main/jitterbuf.c Sun Jun 24 13:51:41 2007
@@ -38,6 +38,7 @@
 
 #include "jitterbuf.h"
 #include "asterisk/utils.h"
+#include "asterisk/options.h"
 
 /*! define these here, just for ancient compiler systems */
 #define JB_LONGMAX 2147483647L
@@ -532,7 +533,7 @@
 	if (jb->frames)
 		numts = jb->frames->prev->ts - jb->frames->ts;
 	if (numts >= jb->info.conf.max_jitterbuf) {
-		ast_log(LOG_DEBUG, "Attempting to exceed Jitterbuf max %ld timeslots\n",
+		ast_debug(1, "Attempting to exceed Jitterbuf max %ld timeslots\n",
 			jb->info.conf.max_jitterbuf);
 		jb->dropem = 1;
 		return JB_DROP;

Modified: trunk/main/loader.c
URL: http://svn.digium.com/view/asterisk/trunk/main/loader.c?view=diff&rev=71338&r1=71337&r2=71338
==============================================================================
--- trunk/main/loader.c (original)
+++ trunk/main/loader.c Sun Jun 24 13:51:41 2007
@@ -248,8 +248,7 @@
 	for (pos = 0, x = 0; x < 16; x++)
 		pos += sprintf(buf + pos, " %02x", *d++);
 
-	if (option_debug)
-		ast_log(LOG_DEBUG, "Unexpected signature:%s\n", buf);
+	ast_debug(1, "Unexpected signature:%s\n", buf);
 
 	return 0;
 }

Modified: trunk/main/logger.c
URL: http://svn.digium.com/view/asterisk/trunk/main/logger.c?view=diff&rev=71338&r1=71337&r2=71338
==============================================================================
--- trunk/main/logger.c (original)
+++ trunk/main/logger.c Sun Jun 24 13:51:41 2007
@@ -964,16 +964,13 @@
 	if ((addresses = ast_calloc(MAX_BACKTRACE_FRAMES, sizeof(*addresses)))) {
 		count = backtrace(addresses, MAX_BACKTRACE_FRAMES);
 		if ((strings = backtrace_symbols(addresses, count))) {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Got %d backtrace record%c\n", count, count != 1 ? 's' : ' ');
+			ast_debug(1, "Got %d backtrace record%c\n", count, count != 1 ? 's' : ' ');
 			for (i=0; i < count ; i++) {
-				if (option_debug)
-					ast_log(LOG_DEBUG, "#%d: [%08X] %s\n", i, (unsigned int)addresses[i], strings[i]);
+				ast_debug(1, "#%d: [%08X] %s\n", i, (unsigned int)addresses[i], strings[i]);
 			}
 			free(strings);
 		} else {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Could not allocate memory for backtrace\n");
+			ast_debug(1, "Could not allocate memory for backtrace\n");
 		}
 		free(addresses);
 	}

Modified: trunk/main/manager.c
URL: http://svn.digium.com/view/asterisk/trunk/main/manager.c?view=diff&rev=71338&r1=71337&r2=71338
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Sun Jun 24 13:51:41 2007
@@ -1063,7 +1063,7 @@
 			if (!strcmp(md5key, key))
 				error = 0;
 		} else {
-			ast_log(LOG_DEBUG, "MD5 authentication is not possible.  challenge: '%s'\n", 
+			ast_debug(1, "MD5 authentication is not possible.  challenge: '%s'\n", 
 				S_OR(s->challenge, ""));
 			return -1;
 		}
@@ -1370,8 +1370,7 @@
 
 	/* XXX should this go inside the lock ? */
 	s->waiting_thread = pthread_self();	/* let new events wake up this thread */
-	if (option_debug)
-		ast_log(LOG_DEBUG, "Starting waiting for an event!\n");
+	ast_debug(1, "Starting waiting for an event!\n");
 
 	for (x=0; x < timeout || timeout < 0; x++) {
 		ast_mutex_lock(&s->__lock);
@@ -1395,8 +1394,7 @@
 			sleep(1);
 		}
 	}
-	if (option_debug)
-		ast_log(LOG_DEBUG, "Finished waiting for an event!\n");
+	ast_debug(1, "Finished waiting for an event!\n");
 	ast_mutex_lock(&s->__lock);
 	if (s->waiting_thread == pthread_self()) {
 		struct eventqent *eqe;
@@ -1415,8 +1413,7 @@
 			"\r\n", idText);
 		s->waiting_thread = AST_PTHREADT_NULL;
 	} else {
-		if (option_debug)
-			ast_log(LOG_DEBUG, "Abandoning event request!\n");
+		ast_debug(1, "Abandoning event request!\n");
 	}
 	ast_mutex_unlock(&s->__lock);
 	return 0;
@@ -2327,8 +2324,7 @@
 	const char *user = astman_get_header(m, "Username");
 
 	ast_copy_string(action, astman_get_header(m, "Action"), sizeof(action));
-	if (option_debug)
-		ast_log(LOG_DEBUG, "Manager received command '%s'\n", action);
+	ast_debug(1, "Manager received command '%s'\n", action);
 
 	if (ast_strlen_zero(action)) {
 		astman_send_error(s, m, "Missing action in request");
@@ -3157,12 +3153,10 @@
 
 	if (s->needdestroy) {
 		if (s->inuse == 1) {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Need destroy, doing it now!\n");
+			ast_debug(1, "Need destroy, doing it now!\n");
 			blastaway = 1;
 		} else {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Need destroy, but can't do it yet!\n");
+			ast_debug(1, "Need destroy, but can't do it yet!\n");
 			if (s->waiting_thread != AST_PTHREADT_NULL)
 				pthread_kill(s->waiting_thread, SIGURG);
 			s->inuse--;
@@ -3419,8 +3413,7 @@
 			}  else if (!strcasecmp(var->name, "displayconnects") )
 				user->displayconnects = ast_true(var->value);
 			else {
-				if (option_debug)
-					ast_log(LOG_DEBUG, "%s is an unknown option.\n", var->name);
+				ast_debug(1, "%s is an unknown option.\n", var->name);
 			}
 			var = var->next;
 		}

Modified: trunk/main/rtp.c
URL: http://svn.digium.com/view/asterisk/trunk/main/rtp.c?view=diff&rev=71338&r1=71337&r2=71338
==============================================================================
--- trunk/main/rtp.c (original)
+++ trunk/main/rtp.c Sun Jun 24 13:51:41 2007
@@ -436,34 +436,29 @@
 	int resplen, respleft;
 	
 	if (len < sizeof(struct stun_header)) {
-		if (option_debug)
-			ast_log(LOG_DEBUG, "Runt STUN packet (only %d, wanting at least %d)\n", (int) len, (int) sizeof(struct stun_header));
+		ast_debug(1, "Runt STUN packet (only %d, wanting at least %d)\n", (int) len, (int) sizeof(struct stun_header));
 		return -1;
 	}
 	if (stundebug)
 		ast_verbose("STUN Packet, msg %s (%04x), length: %d\n", stun_msg2str(ntohs(hdr->msgtype)), ntohs(hdr->msgtype), ntohs(hdr->msglen));
 	if (ntohs(hdr->msglen) > len - sizeof(struct stun_header)) {
-		if (option_debug)
-			ast_log(LOG_DEBUG, "Scrambled STUN packet length (got %d, expecting %d)\n", ntohs(hdr->msglen), (int)(len - sizeof(struct stun_header)));
+		ast_debug(1, "Scrambled STUN packet length (got %d, expecting %d)\n", ntohs(hdr->msglen), (int)(len - sizeof(struct stun_header)));
 	} else
 		len = ntohs(hdr->msglen);
 	data += sizeof(struct stun_header);
 	memset(&st, 0, sizeof(st));
 	while (len) {
 		if (len < sizeof(struct stun_attr)) {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Runt Attribute (got %d, expecting %d)\n", (int)len, (int) sizeof(struct stun_attr));
+			ast_debug(1, "Runt Attribute (got %d, expecting %d)\n", (int)len, (int) sizeof(struct stun_attr));
 			break;
 		}
 		attr = (struct stun_attr *)data;
 		if (ntohs(attr->len) > len) {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Inconsistent Attribute (length %d exceeds remaining msg len %d)\n", ntohs(attr->len), (int)len);
+			ast_debug(1, "Inconsistent Attribute (length %d exceeds remaining msg len %d)\n", ntohs(attr->len), (int)len);
 			break;
 		}
 		if (stun_process_attr(&st, attr)) {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Failed to handle attribute %s (%04x)\n", stun_attr2str(ntohs(attr->attr)), ntohs(attr->attr));
+			ast_debug(1, "Failed to handle attribute %s (%04x)\n", stun_attr2str(ntohs(attr->attr)), ntohs(attr->attr));
 			break;
 		}
 		/* Clear attribute in case previous entry was a string */
@@ -638,14 +633,12 @@
 {
 	if (((ast_test_flag(rtp, FLAG_DTMF_COMPENSATE) && type == AST_FRAME_DTMF_END) ||
 	     (type == AST_FRAME_DTMF_BEGIN)) && ast_tvcmp(ast_tvnow(), rtp->dtmfmute) < 0) {
-		if (option_debug)
-			ast_log(LOG_DEBUG, "Ignore potential DTMF echo from '%s'\n", ast_inet_ntoa(rtp->them.sin_addr));
+		ast_debug(1, "Ignore potential DTMF echo from '%s'\n", ast_inet_ntoa(rtp->them.sin_addr));
 		rtp->resp = 0;
 		rtp->dtmfsamples = 0;
 		return &ast_null_frame;
 	}
-	if (option_debug)
-		ast_log(LOG_DEBUG, "Sending dtmf: %d (%c), at %s\n", rtp->resp, rtp->resp, ast_inet_ntoa(rtp->them.sin_addr));
+	ast_debug(1, "Sending dtmf: %d (%c), at %s\n", rtp->resp, rtp->resp, ast_inet_ntoa(rtp->them.sin_addr));
 	if (rtp->resp == 'X') {
 		rtp->f.frametype = AST_FRAME_CONTROL;
 		rtp->f.subclass = AST_CONTROL_FLASH;
@@ -944,8 +937,7 @@
 		}
 	}
 
-	if (option_debug)
-		ast_log(LOG_DEBUG, "Got RTCP report of %d bytes\n", res);
+	ast_debug(1, "Got RTCP report of %d bytes\n", res);
 
 	/* Process a compound packet */
 	position = 0;
@@ -1109,8 +1101,7 @@
 				ast_verbose("Received a BYE from %s:%d\n", ast_inet_ntoa(rtp->rtcp->them.sin_addr), ntohs(rtp->rtcp->them.sin_port));
 			break;
 		default:
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Unknown RTCP packet (pt=%d) received from %s:%d\n", pt, ast_inet_ntoa(rtp->rtcp->them.sin_addr), ntohs(rtp->rtcp->them.sin_port));
+			ast_debug(1, "Unknown RTCP packet (pt=%d) received from %s:%d\n", pt, ast_inet_ntoa(rtp->rtcp->them.sin_addr), ntohs(rtp->rtcp->them.sin_port));
 			break;
 		}
 		position += (length + 1);
@@ -1204,8 +1195,7 @@
 	res = sendto(bridged->s, (void *)rtpheader, len, 0, (struct sockaddr *)&bridged->them, sizeof(bridged->them));
 	if (res < 0) {
 		if (!bridged->nat || (bridged->nat && (ast_test_flag(bridged, FLAG_NAT_ACTIVE) == FLAG_NAT_ACTIVE))) {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "RTP Transmission error of packet to %s:%d: %s\n", ast_inet_ntoa(bridged->them.sin_addr), ntohs(bridged->them.sin_port), strerror(errno));
+			ast_debug(1, "RTP Transmission error of packet to %s:%d: %s\n", ast_inet_ntoa(bridged->them.sin_addr), ntohs(bridged->them.sin_port), strerror(errno));
 		} else if (((ast_test_flag(bridged, FLAG_NAT_ACTIVE) == FLAG_NAT_INACTIVE) || rtpdebug) && !ast_test_flag(bridged, FLAG_NAT_INACTIVE_NOWARN)) {
 			if (option_debug || rtpdebug)
 				ast_log(LOG_DEBUG, "RTP NAT: Can't write RTP to private address %s:%d, waiting for other end to send audio...\n", ast_inet_ntoa(bridged->them.sin_addr), ntohs(bridged->them.sin_port));
@@ -1632,16 +1622,14 @@
 	if (c1)
 		srcpr = get_proto(c1);
 	if (!destpr) {
-		if (option_debug)
-			ast_log(LOG_DEBUG, "Channel '%s' has no RTP, not doing anything\n", c0->name);
+		ast_debug(1, "Channel '%s' has no RTP, not doing anything\n", c0->name);
 		ast_channel_unlock(c0);
 		if (c1)
 			ast_channel_unlock(c1);
 		return -1;
 	}
 	if (!srcpr) {
-		if (option_debug)
-			ast_log(LOG_DEBUG, "Channel '%s' has no RTP, not doing anything\n", c1 ? c1->name : "<unspecified>");
+		ast_debug(1, "Channel '%s' has no RTP, not doing anything\n", c1 ? c1->name : "<unspecified>");
 		ast_channel_unlock(c0);
 		if (c1)
 			ast_channel_unlock(c1);
@@ -1692,8 +1680,7 @@
 	ast_channel_unlock(c0);
 	if (c1)
 		ast_channel_unlock(c1);
-	if (option_debug)
-		ast_log(LOG_DEBUG, "Setting early bridge SDP of '%s' with that of '%s'\n", c0->name, c1 ? c1->name : "<unspecified>");
+	ast_debug(1, "Setting early bridge SDP of '%s' with that of '%s'\n", c0->name, c1 ? c1->name : "<unspecified>");
 	return 0;
 }
 
@@ -1717,15 +1704,13 @@
 
 	/* Find channel driver interfaces */
 	if (!(destpr = get_proto(dest))) {
-		if (option_debug)
-			ast_log(LOG_DEBUG, "Channel '%s' has no RTP, not doing anything\n", dest->name);
+		ast_debug(1, "Channel '%s' has no RTP, not doing anything\n", dest->name);
 		ast_channel_unlock(dest);
 		ast_channel_unlock(src);
 		return 0;
 	}
 	if (!(srcpr = get_proto(src))) {
-		if (option_debug)
-			ast_log(LOG_DEBUG, "Channel '%s' has no RTP, not doing anything\n", src->name);
+		ast_debug(1, "Channel '%s' has no RTP, not doing anything\n", src->name);
 		ast_channel_unlock(dest);
 		ast_channel_unlock(src);
 		return 0;
@@ -1768,8 +1753,7 @@
 	}
 	ast_channel_unlock(dest);
 	ast_channel_unlock(src);
-	if (option_debug)
-		ast_log(LOG_DEBUG, "Seeded SDP of '%s' with that of '%s'\n", dest->name, src->name);
+	ast_debug(1, "Seeded SDP of '%s' with that of '%s'\n", dest->name, src->name);
 	return 1;
 }
 
@@ -2791,8 +2775,7 @@
 			if (abs(rtp->lastts - pred) < MAX_TIMESTAMP_SKEW)
 				rtp->lastts = pred;
 			else {
-				if (option_debug > 2)
-					ast_log(LOG_DEBUG, "Difference is %d, ms is %d\n", abs(rtp->lastts - pred), ms);
+				ast_debug(3, "Difference is %d, ms is %d\n", abs(rtp->lastts - pred), ms);
 				mark = 1;
 			}
 		}
@@ -2807,8 +2790,7 @@
 				rtp->lastts = pred;
 				rtp->lastovidtimestamp += f->samples;
 			} else {
-				if (option_debug > 2)
-					ast_log(LOG_DEBUG, "Difference is %d, ms is %d (%d), pred/ts/samples %d/%d/%d\n", abs(rtp->lastts - pred), ms, ms * 90, rtp->lastts, pred, f->samples);
+				ast_debug(3, "Difference is %d, ms is %d (%d), pred/ts/samples %d/%d/%d\n", abs(rtp->lastts - pred), ms, ms * 90, rtp->lastts, pred, f->samples);
 				rtp->lastovidtimestamp = rtp->lastts;
 			}
 		}
@@ -2822,8 +2804,7 @@
 				rtp->lastts = pred;
 				rtp->lastotexttimestamp += f->samples;
 			} else {
-				if (option_debug > 2)
-					ast_log(LOG_DEBUG, "Difference is %d, ms is %d (%d), pred/ts/samples %d/%d/%d\n", abs(rtp->lastts - pred), ms, ms * 90, rtp->lastts, pred, f->samples);
+				ast_debug(3, "Difference is %d, ms is %d (%d), pred/ts/samples %d/%d/%d\n", abs(rtp->lastts - pred), ms, ms * 90, rtp->lastts, pred, f->samples);
 				rtp->lastotexttimestamp = rtp->lastts;
 			}
 		}
@@ -2848,8 +2829,7 @@
 		res = sendto(rtp->s, (void *)rtpheader, f->datalen + hdrlen, 0, (struct sockaddr *)&rtp->them, sizeof(rtp->them));
 		if (res <0) {
 			if (!rtp->nat || (rtp->nat && (ast_test_flag(rtp, FLAG_NAT_ACTIVE) == FLAG_NAT_ACTIVE))) {
-				if (option_debug)
-					ast_log(LOG_DEBUG, "RTP Transmission error of packet %d to %s:%d: %s\n", rtp->seqno, ast_inet_ntoa(rtp->them.sin_addr), ntohs(rtp->them.sin_port), strerror(errno));
+				ast_debug(1, "RTP Transmission error of packet %d to %s:%d: %s\n", rtp->seqno, ast_inet_ntoa(rtp->them.sin_addr), ntohs(rtp->them.sin_port), strerror(errno));
 			} else if (((ast_test_flag(rtp, FLAG_NAT_ACTIVE) == FLAG_NAT_INACTIVE) || rtpdebug) && !ast_test_flag(rtp, FLAG_NAT_INACTIVE_NOWARN)) {
 				/* Only give this error message once if we are not RTP debugging */
 				if (option_debug || rtpdebug)
@@ -2938,8 +2918,7 @@
 
 	if (rtp->lasttxformat != subclass) {
 		/* New format, reset the smoother */
-		if (option_debug)
-			ast_log(LOG_DEBUG, "Ooh, format changed from %s to %s\n", ast_getformatname(rtp->lasttxformat), ast_getformatname(subclass));
+		ast_debug(1, "Ooh, format changed from %s to %s\n", ast_getformatname(rtp->lasttxformat), ast_getformatname(subclass));
 		rtp->lasttxformat = subclass;
 		if (rtp->smoother)
 			ast_smoother_free(rtp->smoother);
@@ -2955,8 +2934,7 @@
 			}
 			if (fmt.flags)
 				ast_smoother_set_flags(rtp->smoother, fmt.flags);
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Created smoother: format: %d ms: %d len: %d\n", subclass, fmt.cur_ms, ((fmt.cur_ms * fmt.fr_len) / fmt.inc_ms));
+			ast_debug(1, "Created smoother: format: %d ms: %d len: %d\n", subclass, fmt.cur_ms, ((fmt.cur_ms * fmt.fr_len) / fmt.inc_ms));
 		}
 	}
 	if (rtp->smoother) {
@@ -3054,8 +3032,7 @@
 		if ((c0->tech_pvt != pvt0) ||
 		    (c1->tech_pvt != pvt1) ||
 		    (c0->masq || c0->masqr || c1->masq || c1->masqr)) {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Oooh, something is weird, backing out\n");
+			ast_debug(1, "Oooh, something is weird, backing out\n");
 			if (c0->tech_pvt == pvt0)
 				if (pr0->set_rtp_peer(c0, NULL, NULL, NULL, 0, 0))
 					ast_log(LOG_WARNING, "Channel '%s' failed to break RTP bridge\n", c0->name);
@@ -3084,20 +3061,18 @@
 		    (vp1 && inaddrcmp(&vt1, &vac1)) ||
 		    (tp1 && inaddrcmp(&tt1, &tac1)) ||
 		    (codec1 != oldcodec1)) {
-			if (option_debug > 1) {
-				ast_log(LOG_DEBUG, "Oooh, '%s' changed end address to %s:%d (format %d)\n",
-					c1->name, ast_inet_ntoa(t1.sin_addr), ntohs(t1.sin_port), codec1);
-				ast_log(LOG_DEBUG, "Oooh, '%s' changed end vaddress to %s:%d (format %d)\n",
-					c1->name, ast_inet_ntoa(vt1.sin_addr), ntohs(vt1.sin_port), codec1);
-				ast_log(LOG_DEBUG, "Oooh, '%s' changed end taddress to %s:%d (format %d)\n",
-					c1->name, ast_inet_ntoa(tt1.sin_addr), ntohs(tt1.sin_port), codec1);
-				ast_log(LOG_DEBUG, "Oooh, '%s' was %s:%d/(format %d)\n",
-					c1->name, ast_inet_ntoa(ac1.sin_addr), ntohs(ac1.sin_port), oldcodec1);
-				ast_log(LOG_DEBUG, "Oooh, '%s' was %s:%d/(format %d)\n",
-					c1->name, ast_inet_ntoa(vac1.sin_addr), ntohs(vac1.sin_port), oldcodec1);
-				ast_log(LOG_DEBUG, "Oooh, '%s' was %s:%d/(format %d)\n",
-					c1->name, ast_inet_ntoa(tac1.sin_addr), ntohs(tac1.sin_port), oldcodec1);
-			}
+			ast_debug(2, "Oooh, '%s' changed end address to %s:%d (format %d)\n",
+				c1->name, ast_inet_ntoa(t1.sin_addr), ntohs(t1.sin_port), codec1);
+			ast_debug(2, "Oooh, '%s' changed end vaddress to %s:%d (format %d)\n",
+				c1->name, ast_inet_ntoa(vt1.sin_addr), ntohs(vt1.sin_port), codec1);
+			ast_debug(2, "Oooh, '%s' changed end taddress to %s:%d (format %d)\n",
+				c1->name, ast_inet_ntoa(tt1.sin_addr), ntohs(tt1.sin_port), codec1);
+			ast_debug(2, "Oooh, '%s' was %s:%d/(format %d)\n",
+				c1->name, ast_inet_ntoa(ac1.sin_addr), ntohs(ac1.sin_port), oldcodec1);
+			ast_debug(2, "Oooh, '%s' was %s:%d/(format %d)\n",
+				c1->name, ast_inet_ntoa(vac1.sin_addr), ntohs(vac1.sin_port), oldcodec1);
+			ast_debug(2, "Oooh, '%s' was %s:%d/(format %d)\n",
+				c1->name, ast_inet_ntoa(tac1.sin_addr), ntohs(tac1.sin_port), oldcodec1);
 			if (pr0->set_rtp_peer(c0, t1.sin_addr.s_addr ? p1 : NULL, vt1.sin_addr.s_addr ? vp1 : NULL, tt1.sin_addr.s_addr ? tp1 : NULL, codec1, ast_test_flag(p1, FLAG_NAT_ACTIVE)))
 				ast_log(LOG_WARNING, "Channel '%s' failed to update to '%s'\n", c0->name, c1->name);
 			memcpy(&ac1, &t1, sizeof(ac1));
@@ -3108,12 +3083,10 @@
 		if ((inaddrcmp(&t0, &ac0)) ||
 		    (vp0 && inaddrcmp(&vt0, &vac0)) ||
 		    (tp0 && inaddrcmp(&tt0, &tac0))) {
-			if (option_debug > 1) {
-				ast_log(LOG_DEBUG, "Oooh, '%s' changed end address to %s:%d (format %d)\n",
-					c0->name, ast_inet_ntoa(t0.sin_addr), ntohs(t0.sin_port), codec0);
-				ast_log(LOG_DEBUG, "Oooh, '%s' was %s:%d/(format %d)\n",
-					c0->name, ast_inet_ntoa(ac0.sin_addr), ntohs(ac0.sin_port), oldcodec0);
-			}
+			ast_debug(2, "Oooh, '%s' changed end address to %s:%d (format %d)\n",
+				c0->name, ast_inet_ntoa(t0.sin_addr), ntohs(t0.sin_port), codec0);
+			ast_debug(2, "Oooh, '%s' was %s:%d/(format %d)\n",
+				c0->name, ast_inet_ntoa(ac0.sin_addr), ntohs(ac0.sin_port), oldcodec0);
 			if (pr1->set_rtp_peer(c1, t0.sin_addr.s_addr ? p0 : NULL, vt0.sin_addr.s_addr ? vp0 : NULL, tt0.sin_addr.s_addr ? tp0 : NULL, codec0, ast_test_flag(p0, FLAG_NAT_ACTIVE)))
 				ast_log(LOG_WARNING, "Channel '%s' failed to update to '%s'\n", c1->name, c0->name);
 			memcpy(&ac0, &t0, sizeof(ac0));
@@ -3131,8 +3104,7 @@
 					ast_log(LOG_WARNING, "Channel '%s' failed to break RTP bridge\n", c1->name);
 				return AST_BRIDGE_RETRY;
 			}
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Ooh, empty read...\n");
+			ast_debug(1, "Ooh, empty read...\n");
 			if (ast_check_hangup(c0) || ast_check_hangup(c1))
 				break;
 			continue;
@@ -3145,8 +3117,7 @@
 			/* Break out of bridge */
 			*fo = fr;
 			*rc = who;
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Oooh, got a %s\n", fr ? "digit" : "hangup");
+			ast_debug(1, "Oooh, got a %s\n", fr ? "digit" : "hangup");
 			if (c0->tech_pvt == pvt0)
 				if (pr0->set_rtp_peer(c0, NULL, NULL, NULL, 0, 0))
 					ast_log(LOG_WARNING, "Channel '%s' failed to break RTP bridge\n", c0->name);
@@ -3176,8 +3147,7 @@
 			} else {
 				*fo = fr;
 				*rc = who;
-				if (option_debug)
-					ast_log(LOG_DEBUG, "Got a FRAME_CONTROL (%d) frame on channel %s\n", fr->subclass, who->name);
+				ast_debug(1, "Got a FRAME_CONTROL (%d) frame on channel %s\n", fr->subclass, who->name);
 				return AST_BRIDGE_COMPLETE;
 			}
 		} else {
@@ -3338,8 +3308,7 @@
 		if ((c0->tech_pvt != pvt0) ||
 		    (c1->tech_pvt != pvt1) ||
 		    (c0->masq || c0->masqr || c1->masq || c1->masqr)) {
-			if (option_debug > 2)
-				ast_log(LOG_DEBUG, "p2p-rtp-bridge: Oooh, something is weird, backing out\n");
+			ast_debug(3, "p2p-rtp-bridge: Oooh, something is weird, backing out\n");
 			/* If a masquerade needs to happen we have to try to read in a frame so that it actually happens. Without this we risk being called again and going into a loop */
 			if ((c0->masq || c0->masqr) && (fr = ast_read(c0)))
 				ast_frfree(fr);
@@ -3370,8 +3339,7 @@
 			/* Record received frame and who */
 			*fo = fr;
 			*rc = who;
-			if (option_debug > 2)
-				ast_log(LOG_DEBUG, "p2p-rtp-bridge: Ooh, got a %s\n", fr ? "digit" : "hangup");
+			ast_debug(3, "p2p-rtp-bridge: Ooh, got a %s\n", fr ? "digit" : "hangup");
 			res = AST_BRIDGE_COMPLETE;
 			break;
 		} else if ((fr->frametype == AST_FRAME_CONTROL) && !(flags & AST_BRIDGE_IGNORE_SIGS)) {
@@ -3400,8 +3368,7 @@
 			} else {
 				*fo = fr;
 				*rc = who;
-				if (option_debug > 2)
-					ast_log(LOG_DEBUG, "p2p-rtp-bridge: Got a FRAME_CONTROL (%d) frame on channel %s\n", fr->subclass, who->name);
+				ast_debug(3, "p2p-rtp-bridge: Got a FRAME_CONTROL (%d) frame on channel %s\n", fr->subclass, who->name);
 				res = AST_BRIDGE_COMPLETE;
 				break;
 			}
@@ -3578,8 +3545,7 @@
 	codec1 = pr1->get_codec ? pr1->get_codec(c1) : 0;
 	if (codec0 && codec1 && !(codec0 & codec1)) {
 		/* Hey, we can't do native bridging if both parties speak different codecs */
-		if (option_debug > 2)
-			ast_log(LOG_DEBUG, "Channel codec0 = %d is not codec1 = %d, cannot native bridge in RTP.\n", codec0, codec1);
+		ast_debug(3, "Channel codec0 = %d is not codec1 = %d, cannot native bridge in RTP.\n", codec0, codec1);
 		ast_channel_unlock(c0);
 		ast_channel_unlock(c1);
 		return AST_BRIDGE_FAILED_NOWARN;
@@ -3591,8 +3557,7 @@
 
 		/* In order to do Packet2Packet bridging both sides must be in the same rawread/rawwrite */
 		if (c0->rawreadformat != c1->rawwriteformat || c1->rawreadformat != c0->rawwriteformat) {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Cannot packet2packet bridge - raw formats are incompatible\n");
+			ast_debug(1, "Cannot packet2packet bridge - raw formats are incompatible\n");
 			ast_channel_unlock(c0);
 			ast_channel_unlock(c1);
 			return AST_BRIDGE_FAILED_NOWARN;

Modified: trunk/main/say.c
URL: http://svn.digium.com/view/asterisk/trunk/main/say.c?view=diff&rev=71338&r1=71337&r2=71338
==============================================================================
--- trunk/main/say.c (original)
+++ trunk/main/say.c Sun Jun 24 13:51:41 2007
@@ -508,8 +508,7 @@
 						num = num % 1000000;
 						snprintf(fn, sizeof(fn), "digits/million");
 					} else {
-						if (option_debug)
-							ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
+						ast_debug(1, "Number '%d' is too big for me\n", num);
 						res = -1;
 					}
 				}
@@ -738,8 +737,7 @@
 							snprintf(fn, sizeof(fn), "digits/millions");
 						num = num % 1000000;
 					} else {
-						if (option_debug)
-							ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
+						ast_debug(1, "Number '%d' is too big for me\n", num);
 						res = -1;
 					}
 				}
@@ -874,8 +872,7 @@
 				snprintf(fn, sizeof(fn), "digits/milliards");
 			}
 		} else {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
+			ast_debug(1, "Number '%d' is too big for me\n", num);
 			res = -1;
 		}
 		if (!res) {
@@ -960,8 +957,7 @@
 				if (num && num < 100)
 					playa++;
 		} else {
-				if (option_debug)
-					ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
+				ast_debug(1, "Number '%d' is too big for me\n", num);
 				res = -1;
 		}
 		
@@ -1062,8 +1058,7 @@
 						}
 						num = num % 1000000;
 					} else {
-						if (option_debug)
-							ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
+						ast_debug(1, "Number '%d' is too big for me\n", num);
 						res = -1;
 					}
 				}
@@ -1159,8 +1154,7 @@
 			snprintf(fn, sizeof(fn), "digits/million");
 			num = num % 1000000;
 		} else {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
+			ast_debug(1, "Number '%d' is too big for me\n", num);
 			res = -1;
 		}
 		if (!res) {
@@ -1309,8 +1303,7 @@
 			snprintf(fn, sizeof(fn), "digits/million");
 			num = num % 1000000;
 		} else {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
+			ast_debug(1, "Number '%d' is too big for me\n", num);
 			res = -1;
 		}
 		if (!res) {
@@ -1541,8 +1534,7 @@
 							else
 								snprintf(fn, sizeof(fn), "digits/millions");
 						} else {
-							if (option_debug)
-								ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
+							ast_debug(1, "Number '%d' is too big for me\n", num);
 							res = -1;
 						}
 					}
@@ -1618,8 +1610,7 @@
 						num = num % 1000000;
 						snprintf(fn, sizeof(fn), "digits/million");
 					} else {
-						if (option_debug)
-							ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
+						ast_debug(1, "Number '%d' is too big for me\n", num);
 						res = -1;
 					}
 				}
@@ -1714,8 +1705,7 @@
 				if (num && num < 100)
 					playa++;
 		} else {
-				if (option_debug)
-					ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
+				ast_debug(1, "Number '%d' is too big for me\n", num);
 				res = -1;
 		}
 		
@@ -1766,8 +1756,7 @@
 {    
 	char file_name[255] = "digits/";
 	strcat(file_name, fn);
-	if (option_debug)
-		ast_log(LOG_DEBUG, "Trying to play: %s\n", file_name);
+	ast_debug(1, "Trying to play: %s\n", file_name);
 	if (!ast_streamfile(chan, file_name, language)) {
 		if ((audiofd > -1) && (ctrlfd > -1))
 			ast_waitstream_full(chan, ints, audiofd, ctrlfd);
@@ -2180,8 +2169,7 @@
 						num = num % 1000000;
 						snprintf(fn, sizeof(fn), "digits/million");
 					} else {
-						if (option_debug)
-							ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
+						ast_debug(1, "Number '%d' is too big for me\n", num);
 						res = -1;
 					}
 				}
@@ -2246,8 +2234,7 @@
 							num = num % 1000000;
 							snprintf(fn, sizeof(fn), "digits/million");
 						} else {
-							if (option_debug)
-								ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
+							ast_debug(1, "Number '%d' is too big for me\n", num);
 							res = -1;
 						}
 					}
@@ -2356,8 +2343,7 @@
 			}
 			num %= 1000000;
 		} else {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
+			ast_debug(1, "Number '%d' is too big for me\n", num);
 			res = -1;
 		}
 		if (!res) {
@@ -2471,8 +2457,7 @@
 			snprintf(fn, sizeof(fn), "digits/h-last");
 			num = 0;
 		} else {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
+			ast_debug(1, "Number '%d' is too big for me\n", num);
 			res = -1;
 		}
 
@@ -2625,8 +2610,7 @@
 			snprintf(fn, sizeof(fn), "digits/h-last%s", gender);
 			num = 0;
 		} else {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
+			ast_debug(1, "Number '%d' is too big for me\n", num);
 			res = -1;
 		}
 
@@ -2789,8 +2773,7 @@
 			snprintf(fn, sizeof(fn), "digits/h-last%s", gender);
 			num = 0;
 		} else {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
+			ast_debug(1, "Number '%d' is too big for me\n", num);
 			res = -1;
 		}
 
@@ -3127,8 +3110,7 @@
 	ast_localtime(&time,&tm,timezone);
 
 	for (offset=0 ; format[offset] != '\0' ; offset++) {
-		if (option_debug)
-			ast_log(LOG_DEBUG, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
+		ast_debug(1, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
 		switch (format[offset]) {
 			/* NOTE:  if you add more options here, please try to be consistent with strftime(3) */
 			case '\'':
@@ -3370,8 +3352,7 @@
 	ast_localtime(&time,&tm,timezone);
 
 	for (offset=0 ; format[offset] != '\0' ; offset++) {
-		if (option_debug)
-			ast_log(LOG_DEBUG, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
+		ast_debug(1, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
 		switch (format[offset]) {
 			/* NOTE:  if you add more options here, please try to be consistent with strftime(3) */
 			case '\'':
@@ -3576,8 +3557,7 @@
 	ast_localtime(&time,&tm,timezone);
 
 	for (offset=0 ; format[offset] != '\0' ; offset++) {
-		if (option_debug)
-			ast_log(LOG_DEBUG, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
+		ast_debug(1, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
 		switch (format[offset]) {
 			/* NOTE:  if you add more options here, please try to be consistent with strftime(3) */
 			case '\'':
@@ -3807,8 +3787,7 @@
 	ast_localtime(&time,&tm,timezone);
 
 	for (offset=0 ; format[offset] != '\0' ; offset++) {
-		if (option_debug)
-			ast_log(LOG_DEBUG, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
+		ast_debug(1, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
 		switch (format[offset]) {
 			/* NOTE:  if you add more options here, please try to be consistent with strftime(3) */
 			case '\'':
@@ -3990,8 +3969,7 @@
 	ast_localtime(&time,&tm,timezone);
 
 	for (offset=0 ; format[offset] != '\0' ; offset++) {
-		if (option_debug)
-			ast_log(LOG_DEBUG, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
+		ast_debug(1, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
 		switch (format[offset]) {
 			/* NOTE:  if you add more options here, please try to be consistent with strftime(3) */
 			case '\'':
@@ -4183,8 +4161,7 @@
 	ast_localtime(&time,&tm,timezone);
 
 	for (offset=0 ; format[offset] != '\0' ; offset++) {
-		if (option_debug)
-			ast_log(LOG_DEBUG, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
+		ast_debug(1, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
 		switch (format[offset]) {
 			/* NOTE:  if you add more options here, please try to be consistent with strftime(3) */
 			case '\'':
@@ -4382,8 +4359,7 @@
 	ast_localtime(&time,&tm,timezone);
 

[... 252 lines stripped ...]



More information about the asterisk-commits mailing list