Index: include/asterisk/logger.h =================================================================== --- include/asterisk/logger.h (revision 10392) +++ include/asterisk/logger.h (working copy) @@ -73,6 +73,8 @@ extern int ast_unregister_verbose(void (*verboser)(const char *string, int opos, int replacelast, int complete)); extern int ast_verbose_dmesg(void (*verboser)(const char *string, int opos, int replacelast, int complete)); extern void ast_console_puts(const char *string); +extern void ast_console_puts_mutable(const char *string); +extern void ast_console_mute(int fd); #define _A_ __FILE__, __LINE__, __PRETTY_FUNCTION__ Index: asterisk.c =================================================================== --- asterisk.c (revision 10392) +++ asterisk.c (working copy) @@ -182,6 +182,7 @@ int fd; /*!< File descriptor */ int p[2]; /*!< Pipe */ pthread_t t; /*!< Thread of handler */ + int mute; /*!< Is the console muted for logs */ }; static struct ast_atexit { @@ -472,6 +473,51 @@ } /*! + * mute or unmute a console from logging + */ +void ast_console_mute(int fd) { + int x; + for (x=0;x -1) + fdprint(consoles[x].p[1], string); + } +} + +/*! + * log the string to the console, and all attached + * console clients + */ +void ast_console_puts_mutable(const char *string) +{ + fputs(string, stdout); + fflush(stdout); + ast_network_puts_mutable(string); +} + +/*! * write the string to all attached console clients */ static void ast_network_puts(const char *string) @@ -502,14 +548,14 @@ if (t) { sprintf(t, "\r%s", s); if (complete) - ast_network_puts(t); + ast_network_puts_mutable(t); } else { ast_log(LOG_ERROR, "Out of memory\n"); - ast_network_puts(s); + ast_network_puts_mutable(s); } } else { if (complete) - ast_network_puts(s); + ast_network_puts_mutable(s); } } Index: cli.c =================================================================== --- cli.c (revision 10392) +++ cli.c (working copy) @@ -120,6 +120,11 @@ " no messages should be displayed. Equivalent to -d[d[d...]]\n" " on startup.\n"; +static char set_mute_help[] = +"Usage: set mute\n" +" Disables logging output to a console, making it possible to gather\n" +" information without being disturbed by scrolling lines.\n"; + static char softhangup_help[] = "Usage: soft hangup \n" " Request that a channel be hung up. The hangup takes effect\n" @@ -212,6 +217,14 @@ return RESULT_SUCCESS; } +static int handle_set_mute(int fd, int argc, char *argv[]) +{ + if (argc != 2) + return RESULT_SHOWUSAGE; + ast_console_mute(fd); + return RESULT_SUCCESS; +} + static int handle_unload(int fd, int argc, char *argv[]) { int x; @@ -884,6 +897,7 @@ { { "no", "debug", "channel", NULL }, handle_nodebugchan, "Disable debugging on a channel", nodebugchan_help, complete_ch_4 }, { { "reload", NULL }, handle_reload, "Reload configuration", reload_help, complete_mod_2 }, { { "set", "debug", NULL }, handle_set_debug, "Set level of debug chattiness", set_debug_help }, + { { "set", "mute", NULL }, handle_set_mute, "Disable logging output to a console", set_mute_help }, { { "set", "verbose", NULL }, handle_set_verbose, "Set level of verboseness", set_verbose_help }, { { "show", "channel", NULL }, handle_showchan, "Display information on a specific channel", showchan_help, complete_ch_3 }, { { "show", "channels", NULL }, handle_chanlist, "Display information on channels", chanlist_help, complete_show_channels }, Index: logger.c =================================================================== --- logger.c (revision 10392) +++ logger.c (working copy) @@ -770,11 +770,11 @@ term_color(tmp3, linestr, COLOR_BRWHITE, 0, sizeof(tmp3)), term_color(tmp4, function, COLOR_BRWHITE, 0, sizeof(tmp4))); - ast_console_puts(buf); + ast_console_puts_mutable(buf); va_start(ap, fmt); vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); - ast_console_puts(buf); + ast_console_puts_mutable(buf); } /* File channels */ } else if ((chan->logmask & (1 << level)) && (chan->fileptr)) {