Index: main/app.c =================================================================== --- main/app.c (revision 51189) +++ main/app.c (working copy) @@ -420,7 +420,8 @@ /* We go at next loop if we got the restart char */ if (restart && strchr(restart, res)) { - ast_log(LOG_DEBUG, "we'll restart the stream here at next loop\n"); + if (option_debug) + ast_log(LOG_DEBUG, "we'll restart the stream here at next loop\n"); pause_restart_point = 0; continue; } @@ -512,7 +513,8 @@ return -1; } - ast_log(LOG_DEBUG,"play_and_record: %s, %s, '%s'\n", playfile ? playfile : "", recordfile, fmt); + if (option_debug) + ast_log(LOG_DEBUG,"play_and_record: %s, %s, '%s'\n", playfile ? playfile : "", recordfile, fmt); snprintf(comment, sizeof(comment), "Playing %s, Recording to: %s on %s\n", playfile ? playfile : "", recordfile, chan->name); if (playfile || beep) { @@ -533,7 +535,8 @@ stringp = fmts; strsep(&stringp, "|"); - ast_log(LOG_DEBUG, "Recording Formats: sfmts=%s\n", fmts); + if (option_debug) + ast_log(LOG_DEBUG, "Recording Formats: sfmts=%s\n", fmts); sfmt[0] = ast_strdupa(fmts); while ((fmt = strsep(&stringp, "|"))) { @@ -588,7 +591,8 @@ for (;;) { res = ast_waitfor(chan, 2000); if (!res) { - ast_log(LOG_DEBUG, "One waitfor failed, trying another\n"); + if (option_debug) + ast_log(LOG_DEBUG, "One waitfor failed, trying another\n"); /* Try one more time in case of masq */ res = ast_waitfor(chan, 2000); if (!res) { @@ -935,7 +939,8 @@ ast_log(LOG_WARNING, "Failed to lock path '%s': %s\n", path, strerror(errno)); return AST_LOCK_TIMEOUT; } else { - ast_log(LOG_DEBUG, "Locked path '%s'\n", path); + if (option_debug) + ast_log(LOG_DEBUG, "Locked path '%s'\n", path); return AST_LOCK_SUCCESS; } } @@ -954,8 +959,10 @@ if ((res = unlink(s))) ast_log(LOG_ERROR, "Could not unlock path '%s': %s\n", path, strerror(errno)); - else - ast_log(LOG_DEBUG, "Unlocked path '%s'\n", path); + else { + if (option_debug) + ast_log(LOG_DEBUG, "Unlocked path '%s'\n", path); + } return res; } @@ -1185,7 +1192,8 @@ while(menu->options[pos].option) { if (!strcasecmp(menu->options[pos].option, exten)) { res = ivr_dispatch(chan, menu->options + pos, exten, cbdata); - ast_log(LOG_DEBUG, "IVR Dispatch of '%s' (pos %d) yields %d\n", exten, pos, res); + if (option_debug) + ast_log(LOG_DEBUG, "IVR Dispatch of '%s' (pos %d) yields %d\n", exten, pos, res); if (res < 0) break; else if (res & RES_UPONE) @@ -1201,7 +1209,8 @@ if (!maxretries) maxretries = 3; if ((maxretries > 0) && (retries >= maxretries)) { - ast_log(LOG_DEBUG, "Max retries %d exceeded\n", maxretries); + if (option_debug) + ast_log(LOG_DEBUG, "Max retries %d exceeded\n", maxretries); return -2; } else { if (option_exists(menu, "g") > -1) @@ -1212,24 +1221,28 @@ pos = 0; continue; } else if (res && strchr(AST_DIGIT_ANY, res)) { - ast_log(LOG_DEBUG, "Got start of extension, %c\n", res); + if (option_debug) + ast_log(LOG_DEBUG, "Got start of extension, %c\n", res); exten[1] = '\0'; exten[0] = res; if ((res = read_newoption(chan, menu, exten, sizeof(exten)))) break; if (option_exists(menu, exten) < 0) { if (option_exists(menu, "i")) { - ast_log(LOG_DEBUG, "Invalid extension entered, going to 'i'!\n"); + if (option_debug) + ast_log(LOG_DEBUG, "Invalid extension entered, going to 'i'!\n"); strcpy(exten, "i"); pos = 0; continue; } else { - ast_log(LOG_DEBUG, "Aborting on invalid entry, with no 'i' option!\n"); + if (option_debug) + ast_log(LOG_DEBUG, "Aborting on invalid entry, with no 'i' option!\n"); res = -2; break; } } else { - ast_log(LOG_DEBUG, "New existing extension: %s\n", exten); + if (option_debug) + ast_log(LOG_DEBUG, "New existing extension: %s\n", exten); pos = 0; continue; } @@ -1237,7 +1250,8 @@ } pos++; } - ast_log(LOG_DEBUG, "Stopping option '%s', res is %d\n", exten, res); + if (option_debug) + ast_log(LOG_DEBUG, "Stopping option '%s', res is %d\n", exten, res); pos = 0; if (!strcasecmp(exten, "s")) strcpy(exten, "g");