[Asterisk-code-review] Replace direct checks of option debug with DEBUG ATLEAST macro. (asterisk[13])

Richard Mudgett asteriskteam at digium.com
Wed Mar 7 15:38:05 CST 2018


Richard Mudgett has posted comments on this change. ( https://gerrit.asterisk.org/8451 )

Change subject: Replace direct checks of option_debug with DEBUG_ATLEAST macro.
......................................................................


Patch Set 2: Code-Review-1

(4 comments)

https://gerrit.asterisk.org/#/c/8451/2/channels/chan_sip.c
File channels/chan_sip.c:

https://gerrit.asterisk.org/#/c/8451/2/channels/chan_sip.c@22343
PS2, Line 22343: 	ast_log(LOG_DEBUG, "\n---------- SIP HISTORY for '%s' \n", dialog->callid);
               : 	if (dialog->subscribed) {
               : 		ast_log(LOG_DEBUG, "  * Subscription\n");
               : 	} else {
               : 		ast_log(LOG_DEBUG, "  * SIP Call\n");
               : 	}
               : 	if (dialog->history) {
               : 		AST_LIST_TRAVERSE(dialog->history, hist, list)
               : 			ast_log(LOG_DEBUG, "  %-3.3d. %s\n", ++x, hist->event);
               : 	}
               : 	if (!x) {
               : 		ast_log(LOG_DEBUG, "Call '%s' has no history\n", dialog->callid);
               : 	}
               : 	ast_log(LOG_DEBUG, "\n---------- END SIP HISTORY for '%s' \n", dialog->callid);
Heh.  This change appears to fix a bug in the bargain.

The notice message earlier in the function says the logging happens when either SIP or Asterisk DEBUG logging is enabled.  Before it only went out if Asterisk DEBUG logging was enabled.  Now it goes out when either is enabled.


https://gerrit.asterisk.org/#/c/8451/2/main/config.c
File main/config.c:

https://gerrit.asterisk.org/#/c/8451/2/main/config.c@2790
PS2, Line 2790: 		if (!DEBUG_ATLEAST(1)) {
              : 			ast_verb(2, "Saving '%s': saved\n", fn);
              : 		}
The original test was bizarre.  Only attempt the verbose log if debugging not enabled?

Should just do ast_verb(2...)


https://gerrit.asterisk.org/#/c/8451/2/main/sched.c
File main/sched.c:

https://gerrit.asterisk.org/#/c/8451/2/main/sched.c@721
PS2, Line 721: 	ast_log(LOG_DEBUG, "Asterisk Schedule Dump (%zu in Q, %u Total, %u Cache, %u high-water)\n", ast_heap_size(con->sched_heap), con->eventcnt - 1, con->schedccnt, con->highwater);
             : #else
             : 	ast_log(LOG_DEBUG, "Asterisk Schedule Dump (%zu in Q, %u Total, %u high-water)\n", ast_heap_size(con->sched_heap), con->eventcnt - 1, con->highwater);
I'd be nice if these long lines were broken after the format string. :)


https://gerrit.asterisk.org/#/c/8451/2/res/res_rtp_asterisk.c
File res/res_rtp_asterisk.c:

https://gerrit.asterisk.org/#/c/8451/2/res/res_rtp_asterisk.c@4167
PS2, Line 4167: 		if (DEBUG_ATLEAST(1)) {
              : 			ast_log(LOG_DEBUG, "Ooh, format changed from %s to %s\n",
              : 				ast_format_get_name(rtp->lasttxformat),
              : 				ast_format_get_name(frame->subclass.format));
              : 		}
This is really just an ast_debug(1,...) now.



-- 
To view, visit https://gerrit.asterisk.org/8451
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic342d4799a945dbc40ac085ac142681094a4ebf0
Gerrit-Change-Number: 8451
Gerrit-PatchSet: 2
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Comment-Date: Wed, 07 Mar 2018 21:38:05 +0000
Gerrit-HasComments: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180307/8e9be92e/attachment-0001.html>


More information about the asterisk-code-review mailing list