bug #8076 check option_debug before printing to debug channel.

patch provided in bugnote, with minor changes.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@44253 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Matt O'Gorman
2006-10-03 15:53:07 +00:00
parent c9c1613503
commit ae8cc3e18b
67 changed files with 1718 additions and 922 deletions

View File

@@ -201,7 +201,8 @@ static int sched_settime(struct timeval *tv, int when)
*tv = now;
*tv = ast_tvadd(*tv, ast_samp2tv(when, 1000));
if (ast_tvcmp(*tv, now) < 0) {
ast_log(LOG_DEBUG, "Request to schedule in the past?!?!\n");
if (option_debug)
ast_log(LOG_DEBUG, "Request to schedule in the past?!?!\n");
*tv = now;
}
return 0;
@@ -296,26 +297,29 @@ void ast_sched_dump(const struct sched_context *con)
struct sched *q;
struct timeval tv = ast_tvnow();
#ifdef SCHED_MAX_CACHE
ast_log(LOG_DEBUG, "Asterisk Schedule Dump (%d in Q, %d Total, %d Cache)\n", con->schedcnt, con->eventcnt - 1, con->schedccnt);
if (option_debug)
ast_log(LOG_DEBUG, "Asterisk Schedule Dump (%d in Q, %d Total, %d Cache)\n", con->schedcnt, con->eventcnt - 1, con->schedccnt);
#else
ast_log(LOG_DEBUG, "Asterisk Schedule Dump (%d in Q, %d Total)\n", con->schedcnt, con->eventcnt - 1);
if (option_debug)
ast_log(LOG_DEBUG, "Asterisk Schedule Dump (%d in Q, %d Total)\n", con->schedcnt, con->eventcnt - 1);
#endif
if (option_debug) {
ast_log(LOG_DEBUG, "=============================================================\n");
ast_log(LOG_DEBUG, "|ID Callback Data Time (sec:ms) |\n");
ast_log(LOG_DEBUG, "+-----+-----------------+-----------------+-----------------+\n");
AST_LIST_TRAVERSE(&con->schedq, q, list) {
struct timeval delta = ast_tvsub(q->when, tv);
AST_LIST_TRAVERSE(&con->schedq, q, list) {
struct timeval delta = ast_tvsub(q->when, tv);
ast_log(LOG_DEBUG, "|%.4d | %-15p | %-15p | %.6ld : %.6ld |\n",
q->id,
q->callback,
q->data,
delta.tv_sec,
(long int)delta.tv_usec);
ast_log(LOG_DEBUG, "|%.4d | %-15p | %-15p | %.6ld : %.6ld |\n",
q->id,
q->callback,
q->data,
delta.tv_sec,
(long int)delta.tv_usec);
}
ast_log(LOG_DEBUG, "=============================================================\n");
}
ast_log(LOG_DEBUG, "=============================================================\n");
}
/*! \brief