[svn-commits] tilghman: branch tilghman/verbose r355377 - in /team/tilghman/verbose: addons...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Feb 14 13:38:54 CST 2012


Author: tilghman
Date: Tue Feb 14 13:38:50 2012
New Revision: 355377

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=355377
Log:
ast_verbose() conversions to ast_verb()

Modified:
    team/tilghman/verbose/addons/res_config_mysql.c
    team/tilghman/verbose/codecs/codec_dahdi.c
    team/tilghman/verbose/funcs/func_timeout.c
    team/tilghman/verbose/include/asterisk/logger.h
    team/tilghman/verbose/main/asterisk.c
    team/tilghman/verbose/main/manager.c
    team/tilghman/verbose/main/pbx.c

Modified: team/tilghman/verbose/addons/res_config_mysql.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/verbose/addons/res_config_mysql.c?view=diff&rev=355377&r1=355376&r2=355377
==============================================================================
--- team/tilghman/verbose/addons/res_config_mysql.c (original)
+++ team/tilghman/verbose/addons/res_config_mysql.c Tue Feb 14 13:38:50 2012
@@ -1417,11 +1417,7 @@
 static int reload(void)
 {
 	parse_config(1);
-
-	if (option_verbose > 1) {
-		ast_verb(2, "MySQL RealTime reloaded.\n");
-	}
-
+	ast_verb(2, "MySQL RealTime reloaded.\n");
 	return 0;
 }
 

Modified: team/tilghman/verbose/codecs/codec_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/verbose/codecs/codec_dahdi.c?view=diff&rev=355377&r1=355376&r2=355377
==============================================================================
--- team/tilghman/verbose/codecs/codec_dahdi.c (original)
+++ team/tilghman/verbose/codecs/codec_dahdi.c Tue Feb 14 13:38:50 2012
@@ -176,13 +176,11 @@
 	struct pollfd p = {0};
 	if (!count) return;
 	res = write(dahdip->fd, buffer, count);
-	if (option_verbose > 10) {
-		if (-1 == res) {
-			ast_log(LOG_ERROR, "Failed to write to transcoder: %s\n", strerror(errno));
-		}
-		if (count != res) {
-			ast_log(LOG_ERROR, "Requested write of %zd bytes, but only wrote %d bytes.\n", count, res);
-		}
+	if (-1 == res) {
+		ast_log(LOG_ERROR, "Failed to write to transcoder: %s\n", strerror(errno));
+	}
+	if (count != res) {
+		ast_log(LOG_ERROR, "Requested write of %zd bytes, but only wrote %d bytes.\n", count, res);
 	}
 	p.fd = dahdip->fd;
 	p.events = POLLOUT;

Modified: team/tilghman/verbose/funcs/func_timeout.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/verbose/funcs/func_timeout.c?view=diff&rev=355377&r1=355376&r2=355377
==============================================================================
--- team/tilghman/verbose/funcs/func_timeout.c (original)
+++ team/tilghman/verbose/funcs/func_timeout.c Tue Feb 14 13:38:50 2012
@@ -156,15 +156,13 @@
 	case 'a':
 	case 'A':
 		ast_channel_setwhentohangup_tv(chan, when);
-		if (VERBOSITY_ATLEAST(3)) {
-			if (!ast_tvzero(chan->whentohangup)) {
-				when = ast_tvadd(when, ast_tvnow());
-				ast_strftime(timestr, sizeof(timestr), "%Y-%m-%d %H:%M:%S.%3q %Z",
-					ast_localtime(&when, &myt, NULL));
-				ast_verbose("Channel will hangup at %s.\n", timestr);
-			} else {
-				ast_verbose("Channel hangup cancelled.\n");
-			}
+		if (!ast_tvzero(chan->whentohangup)) {
+			when = ast_tvadd(when, ast_tvnow());
+			ast_strftime(timestr, sizeof(timestr), "%Y-%m-%d %H:%M:%S.%3q %Z",
+				ast_localtime(&when, &myt, NULL));
+			ast_verb(3, "Channel will hangup at %s.\n", timestr);
+		} else {
+			ast_verb(3, "Channel hangup cancelled.\n");
 		}
 		break;
 

Modified: team/tilghman/verbose/include/asterisk/logger.h
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/verbose/include/asterisk/logger.h?view=diff&rev=355377&r1=355376&r2=355377
==============================================================================
--- team/tilghman/verbose/include/asterisk/logger.h (original)
+++ team/tilghman/verbose/include/asterisk/logger.h Tue Feb 14 13:38:50 2012
@@ -238,8 +238,6 @@
 	if (option_debug >= (level) || (ast_opt_dbg_module && ast_debug_get_by_module(AST_MODULE) >= (level)) ) \
 		ast_log(AST_LOG_DEBUG, __VA_ARGS__); \
 } while (0)
-
-#define VERBOSITY_ATLEAST(level) (option_verbose >= (level) || (ast_opt_verb_module && ast_verbose_get_by_module(AST_MODULE) >= (level)))
 
 #define ast_verb(level, ...) __ast_verbose(__FILE__, __LINE__, __PRETTY_FUNCTION__, level, __VA_ARGS__)
 

Modified: team/tilghman/verbose/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/verbose/main/asterisk.c?view=diff&rev=355377&r1=355376&r2=355377
==============================================================================
--- team/tilghman/verbose/main/asterisk.c (original)
+++ team/tilghman/verbose/main/asterisk.c Tue Feb 14 13:38:50 2012
@@ -1502,8 +1502,7 @@
 static void _hup_handler(int num)
 {
 	int a = 0, save_errno = errno;
-	if (option_verbose > 1) 
-		printf("Received HUP signal -- Reloading configs\n");
+	printf("Received HUP signal -- Reloading configs\n");
 	if (restartnow)
 		execvp(_argv[0], _argv);
 	sig_flags.need_reload = 1;
@@ -1589,8 +1588,7 @@
 			ast_log(LOG_WARNING, "Unable to set high priority\n");
 			return -1;
 		} else
-			if (option_verbose)
-				ast_verbose("Set to realtime thread\n");
+			ast_verb(1, "Set to realtime thread\n");
 	} else {
 		sched.sched_priority = 0;
 		/* According to the manpage, these parameters can never fail. */
@@ -1602,8 +1600,7 @@
 			ast_log(LOG_WARNING, "Unable to set high priority\n");
 			return -1;
 		} else
-			if (option_verbose)
-				ast_verbose("Set to high priority\n");
+			ast_verb(1, "Set to high priority\n");
 	} else {
 		/* According to the manpage, these parameters can never fail. */
 		setpriority(PRIO_PROCESS, 0, 0);
@@ -1675,7 +1672,7 @@
 			ast_begin_shutdown(0);
 		}
 		if (option_verbose && ast_opt_console) {
-			ast_verbose("Waiting for inactivity to perform %s...\n", restart ? "restart" : "halt");
+			ast_verb(0, "Waiting for inactivity to perform %s...\n", restart ? "restart" : "halt");
 		}
 		for (;;) {
 			if (!ast_active_channels() || shuttingdown != niceness) {
@@ -1690,7 +1687,7 @@
 	ast_mutex_lock(&safe_system_lock);
 	if (shuttingdown != niceness) {
 		if (shuttingdown == NOT_SHUTTING_DOWN && option_verbose && ast_opt_console) {
-			ast_verbose("Asterisk %s cancelled.\n", restart ? "restart" : "shutdown");
+			ast_verb(0, "Asterisk %s cancelled.\n", restart ? "restart" : "shutdown");
 		}
 		ast_mutex_unlock(&safe_system_lock);
 		return 0;
@@ -1729,12 +1726,10 @@
 			}
 		}
 	}
-	if (option_verbose)
-		ast_verbose("Executing last minute cleanups\n");
+	ast_verb(0, "Executing last minute cleanups\n");
 	ast_run_atexits();
 	/* Called on exit */
-	if (option_verbose && ast_opt_console)
-		ast_verbose("Asterisk %s ending (%d).\n", ast_active_channels() ? "uncleanly" : "cleanly", num);
+	ast_verb(0, "Asterisk %s ending (%d).\n", ast_active_channels() ? "uncleanly" : "cleanly", num);
 	ast_debug(1, "Asterisk ending (%d).\n", num);
 	manager_event(EVENT_FLAG_SYSTEM, "Shutdown", "Shutdown: %s\r\nRestart: %s\r\n", ast_active_channels() ? "Uncleanly" : "Cleanly", restart ? "True" : "False");
 	if (ast_socket > -1) {
@@ -1750,14 +1745,12 @@
 	printf("%s", term_quit());
 	if (restart) {
 		int i;
-		if (option_verbose || ast_opt_console)
-			ast_verbose("Preparing for Asterisk restart...\n");
+		ast_verb(0, "Preparing for Asterisk restart...\n");
 		/* Mark all FD's for closing on exec */
 		for (i = 3; i < 32768; i++) {
 			fcntl(i, F_SETFD, FD_CLOEXEC);
 		}
-		if (option_verbose || ast_opt_console)
-			ast_verbose("Asterisk is now restarting...\n");
+		ast_verb(0, "Asterisk is now restarting...\n");
 		restartnow = 1;
 
 		/* close logger */
@@ -1891,6 +1884,7 @@
 			ast_safe_system(getenv("SHELL") ? getenv("SHELL") : "/bin/sh");
 		ret = 1;
 	} else if (strncasecmp(s, "remote set verbose ", 19) == 0) {
+		int old_verbose = option_verbose;
 		if (strncasecmp(s + 19, "atleast ", 8) == 0) {
 			int tmp;
 			if (sscanf(s + 27, "%d", &tmp) != 1) {
@@ -1899,13 +1893,21 @@
 				if (tmp > option_verbose) {
 					option_verbose = tmp;
 				}
-				fprintf(stdout, "Set remote console verbosity to %d\n", option_verbose);
+				if (old_verbose != option_verbose) {
+					fprintf(stdout, "Set remote console verbosity from %d to %d\n", old_verbose, option_verbose);
+				} else {
+					fprintf(stdout, "Verbosity level unchanged.\n");
+				}
 			}
 		} else {
 			if (sscanf(s + 19, "%d", &option_verbose) != 1) {
 				fprintf(stderr, "Usage: remote set verbose [atleast] <level>\n");
 			} else {
-				fprintf(stdout, "Set remote console verbosity to %d\n", option_verbose);
+				if (old_verbose != option_verbose) {
+					fprintf(stdout, "Set remote console verbosity to %d\n", option_verbose);
+				} else {
+					fprintf(stdout, "Verbosity level unchanged.\n");
+				}
 			}
 		}
 		ret = 1;
@@ -3645,8 +3647,7 @@
 			ast_log(LOG_WARNING, "Unable to drop unneeded groups\n");
 			exit(1);
 		}
-		if (option_verbose)
-			ast_verbose("Running as group '%s'\n", rungroup);
+		ast_verb(1, "Running as group '%s'\n", rungroup);
 	}
 
 	if (runuser && !ast_test_flag(&ast_options, AST_OPT_FLAG_REMOTE)) {
@@ -3686,8 +3687,7 @@
 			ast_log(LOG_WARNING, "Unable to setuid to %d (%s)\n", (int)pw->pw_uid, runuser);
 			exit(1);
 		}
-		if (option_verbose)
-			ast_verbose("Running as user '%s'\n", runuser);
+		ast_verb(1, "Running as user '%s'\n", runuser);
 #ifdef HAVE_CAP
 		if (has_cap) {
 			cap_t cap;
@@ -3741,8 +3741,9 @@
 	printf("%s", term_end());
 	fflush(stdout);
 
-	if (ast_opt_console && !option_verbose) 
+	if (ast_opt_console && !option_verbose) {
 		ast_verbose("[ Initializing Custom Configuration Options ]\n");
+	}
 	/* custom config setup */
 	register_config_cli();
 	read_config_maps();
@@ -4017,15 +4018,14 @@
 
 	/* We might have the option of showing a console, but for now just
 	   do nothing... */
-	if (ast_opt_console && !option_verbose)
-		ast_verbose(" ]\n");
-	if (option_verbose || ast_opt_console)
-		ast_verbose("%s", term_color(tmp, "Asterisk Ready.\n", COLOR_BRWHITE, COLOR_BLACK, sizeof(tmp)));
-	if (ast_opt_no_fork)
+	ast_verb(0, "%s", term_color(tmp, "Asterisk Ready.\n", COLOR_BRWHITE, COLOR_BLACK, sizeof(tmp)));
+	if (ast_opt_no_fork) {
 		consolethread = pthread_self();
-
-	if (pipe(sig_alert_pipe))
+	}
+
+	if (pipe(sig_alert_pipe)) {
 		sig_alert_pipe[0] = sig_alert_pipe[1] = -1;
+	}
 
 	ast_set_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED);
 	manager_event(EVENT_FLAG_SYSTEM, "FullyBooted", "Status: Fully Booted\r\n");

Modified: team/tilghman/verbose/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/verbose/main/manager.c?view=diff&rev=355377&r1=355376&r2=355377
==============================================================================
--- team/tilghman/verbose/main/manager.c (original)
+++ team/tilghman/verbose/main/manager.c Tue Feb 14 13:38:50 2012
@@ -5123,7 +5123,7 @@
 	while ((session = ao2_iterator_next(&i)) && n_max > 0) {
 		ao2_lock(session);
 		if (session->sessiontimeout && (now > session->sessiontimeout) && !session->inuse) {
-			if (session->authenticated && (VERBOSITY_ATLEAST(2)) && manager_displayconnects(session)) {
+			if (session->authenticated && manager_displayconnects(session)) {
 				ast_verb(2, "HTTP Manager '%s' timed out from %s\n",
 					session->username, ast_inet_ntoa(session->sin.sin_addr));
 			}

Modified: team/tilghman/verbose/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/verbose/main/pbx.c?view=diff&rev=355377&r1=355376&r2=355377
==============================================================================
--- team/tilghman/verbose/main/pbx.c (original)
+++ team/tilghman/verbose/main/pbx.c Tue Feb 14 13:38:50 2012
@@ -4369,7 +4369,7 @@
 			ast_channel_trace_update(c);
 #endif
 			ast_debug(1, "Launching '%s'\n", app->name);
-			if (VERBOSITY_ATLEAST(3)) {
+			{
 				char tmp[80], tmp2[80], tmp3[EXT_DATA_SIZE];
 				ast_verb(3, "Executing [%s@%s:%d] %s(\"%s\", \"%s\") %s\n",
 					exten, context, priority,




More information about the svn-commits mailing list