[Home]

Summary:ASTERISK-15591: [patch] Remove coloring escape sequences from log files.
Reporter:dodo (dodo)Labels:
Date Opened:2010-02-08 03:41:37.000-0600Date Closed:2010-04-21 15:04:35
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) logger.patch
( 1) logger1.patch
( 2) logger2.patch
Description:Log files are much more readable without escape sequences.
Comments:By: dodo (dodo) 2010-02-08 03:54:02.000-0600

It's a little piece of code from branch 1.0.

By: Tilghman Lesher (tilghman) 2010-02-08 17:20:49.000-0600

Congratulations.  You just recoded term_strip, which is already in term.c.  Please revise your patch to use term_strip().

By: dodo (dodo) 2010-02-09 03:34:12.000-0600

Thank's for Your comment! So now it's simpler.

By: Jamuel Starkey (jamuel) 2010-02-09 13:50:08.000-0600

Thanks for the patch!

Might I suggest, however, that you make this a configurable option (e.g. logger.conf)?  Some folks might like the coloring while others such as yourself do not . . .

By: Tilghman Lesher (tilghman) 2010-02-09 15:35:27.000-0600

I wouldn't bother with making it configurable.  I agree that the color sequences should not be in log files, and it's probably just an oversight that they are there now.

By: Tilghman Lesher (tilghman) 2010-02-09 15:39:45.000-0600

On the patch itself, please refer to the ast_str structure as opaque, in case we change the structure in the future.  In particular, use ast_str_buffer to access the internal string and use ast_str_strlen to access the length of the string, instead of using strlen on the buffer.  Finally, please realize that the return value of term_strip is the destination buffer, so the command can be placed inline to the output function, instead of stripping the message on a separate line.

By: dodo (dodo) 2010-02-11 04:43:09.000-0600

Hello,
struct logmsg is defined in logger.c, and it is not ast_str so it is not possible to use ast_str_strlen function etc.
Is it possible to write it like this?

res = fprintf(chan->fileptr, "[%s] %s[%ld] %s: %s",
    logmsg->date, levels[logmsg->level], logmsg->process_id, logmsg->file,
     term_strip(logmsg->str, logmsg->str, strlen(logmsg->str) + 1));

By: Digium Subversion (svnbot) 2010-02-24 15:02:19.000-0600

Repository: asterisk
Revision: 248582

U   branches/1.4/main/logger.c

------------------------------------------------------------------------
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 ASTERISK-15591)
Reported by: dodo
Patches:
      logger2.patch uploaded by dodo (license 989)
Tested by: tilghman

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=248582

By: Digium Subversion (svnbot) 2010-02-24 15:17:27.000-0600

Repository: asterisk
Revision: 248584

_U  trunk/
U   trunk/include/asterisk/term.h
U   trunk/main/logger.c
U   trunk/main/term.c

------------------------------------------------------------------------
r248584 | tilghman | 2010-02-24 15:17:26 -0600 (Wed, 24 Feb 2010) | 14 lines

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 ASTERISK-15591)
  Reported by: dodo
  Patches:
        logger2.patch uploaded by dodo (license 989)
  Tested by: tilghman
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=248584

By: Digium Subversion (svnbot) 2010-02-24 15:23:36.000-0600

Repository: asterisk
Revision: 248613

_U  branches/1.6.0/
U   branches/1.6.0/main/logger.c

------------------------------------------------------------------------
r248613 | tilghman | 2010-02-24 15:23:36 -0600 (Wed, 24 Feb 2010) | 21 lines

Merged revisions 248584 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r248584 | tilghman | 2010-02-24 15:17:26 -0600 (Wed, 24 Feb 2010) | 14 lines
 
 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 ASTERISK-15591)
    Reported by: dodo
    Patches:
          logger2.patch uploaded by dodo (license 989)
    Tested by: tilghman
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=248613

By: Digium Subversion (svnbot) 2010-02-24 15:29:24.000-0600

Repository: asterisk
Revision: 248641

_U  branches/1.6.1/
U   branches/1.6.1/main/logger.c

------------------------------------------------------------------------
r248641 | tilghman | 2010-02-24 15:29:23 -0600 (Wed, 24 Feb 2010) | 21 lines

Merged revisions 248584 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r248584 | tilghman | 2010-02-24 15:17:26 -0600 (Wed, 24 Feb 2010) | 14 lines
 
 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 ASTERISK-15591)
    Reported by: dodo
    Patches:
          logger2.patch uploaded by dodo (license 989)
    Tested by: tilghman
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=248641

By: Digium Subversion (svnbot) 2010-02-24 15:29:34.000-0600

Repository: asterisk
Revision: 248643

_U  branches/1.6.2/
U   branches/1.6.2/main/logger.c

------------------------------------------------------------------------
r248643 | tilghman | 2010-02-24 15:29:34 -0600 (Wed, 24 Feb 2010) | 21 lines

Merged revisions 248584 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r248584 | tilghman | 2010-02-24 15:17:26 -0600 (Wed, 24 Feb 2010) | 14 lines
 
 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 ASTERISK-15591)
    Reported by: dodo
    Patches:
          logger2.patch uploaded by dodo (license 989)
    Tested by: tilghman
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=248643