mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 04:11:08 +00:00
Merged revisions 248582 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r248582 | tilghman | 2010-02-24 15:02:18 -0600 (Wed, 24 Feb 2010) | 7 lines Remove color code sequences from verbose messages that go to logfiles. (closes issue #16786) Reported by: dodo Patches: logger2.patch uploaded by dodo (license 989) Tested by: tilghman ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@248584 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -92,7 +92,7 @@ int ast_term_color_code(struct ast_str **str, int fgcolor, int bgcolor);
|
||||
*/
|
||||
char *term_color_code(char *outbuf, int fgcolor, int bgcolor, int maxout);
|
||||
|
||||
char *term_strip(char *outbuf, char *inbuf, int maxout);
|
||||
char *term_strip(char *outbuf, const char *inbuf, int maxout);
|
||||
|
||||
void term_filter_escapes(char *line);
|
||||
|
||||
|
@@ -832,12 +832,13 @@ static void logger_print_normal(struct logmsg *logmsg)
|
||||
int res = 0;
|
||||
|
||||
/* If no file pointer exists, skip it */
|
||||
if (!chan->fileptr)
|
||||
if (!chan->fileptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Print out to the file */
|
||||
res = fprintf(chan->fileptr, "[%s] %s[%ld] %s: %s",
|
||||
logmsg->date, logmsg->level_name, logmsg->process_id, logmsg->file, logmsg->message);
|
||||
logmsg->date, logmsg->level_name, logmsg->process_id, logmsg->file, term_strip(buf, logmsg->message, BUFSIZ));
|
||||
if (res <= 0 && !ast_strlen_zero(logmsg->message)) {
|
||||
fprintf(stderr, "**** Asterisk Logging Error: ***********\n");
|
||||
if (errno == ENOMEM || errno == ENOSPC)
|
||||
|
@@ -268,9 +268,10 @@ char *term_color_code(char *outbuf, int fgcolor, int bgcolor, int maxout)
|
||||
return outbuf;
|
||||
}
|
||||
|
||||
char *term_strip(char *outbuf, char *inbuf, int maxout)
|
||||
char *term_strip(char *outbuf, const char *inbuf, int maxout)
|
||||
{
|
||||
char *outbuf_ptr = outbuf, *inbuf_ptr = inbuf;
|
||||
char *outbuf_ptr = outbuf;
|
||||
const char *inbuf_ptr = inbuf;
|
||||
|
||||
while (outbuf_ptr < outbuf + maxout) {
|
||||
switch (*inbuf_ptr) {
|
||||
|
Reference in New Issue
Block a user