[asterisk-users] colorized logfiles in asterisk 1.6.0.6
Atis Lezdins
atis at iq-labs.net
Mon Mar 9 06:33:05 CDT 2009
On Fri, Mar 6, 2009 at 11:59 PM, Tiago Durante <tiagodurante at gmail.com> wrote:
> On Fri, Mar 6, 2009 at 10:39 AM, Johann Steinwendtner
> <steinwendtner at gmx.net> wrote:
>> Danny Nicholas wrote:
>>> The log files themselves are not in color. It would be a style sheet change
>>> on the GUI.
>>>
>>> -----Original Message-----
>>> From: asterisk-users-bounces at lists.digium.com
>>> [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Johann
>>> Steinwendtner
>>> Sent: Friday, March 06, 2009 2:59 AM
>>> To: Asterisk Users Mailing List - Non-Commercial Discussion
>>> Subject: [asterisk-users] colorized logfiles in asterisk 1.6.0.6
>>>
>>> Hello !
>>>
>>> I've upgraded our testsystem from asterisk 1.4.21 to asterisk 1.6.0.6.
>>> We 've noticed that the log files are now in colour.
>>> I could not find a note in the upgrade section about this.
>>> Is this a feature or a bug ?
>>> It might be usefull to have them not in colour.
>>>
>>> best regards
>>>
>>> Hans
>>
>> Sorry, that I wasn't clear enough. The logfiles contains escape codes +
>> the colour codes.
>> e.g.:
>> [Feb 12 13:38:30] VERBOSE[19816] logger.c: == Registered custom function 'ESC[1;36;40mSQL_ESCESC[0;37;40m'
>> [Feb 12 13:38:30] VERBOSE[19816] logger.c: func_odbc.so => (ESC[33;40mODBC lookupsESC[0;37;40m)
>> [Feb 12 13:38:30] VERBOSE[19816] logger.c: == Registered application 'ESC[1;36;40mReadFileESC[0;37;40m'
>>
>> I do not use a GUI.
>
> same thing happens to me, as far as I noticed only in one server...
> asterisk 1.6.0.5...
>
> when you do a, lets say, tail -f /var/log/asterisk/full its kinda of
> cool, because you can check the log with colors... but the log itself
> become a mess...
>
> regards,
>
Well, it's nice in console, but not that for analyzing. I would prefer
disable option for that.
Also i wrote simple wrapper, to allow browsing logs from web. It might
need some tuning (see if "ANSI: " string comes out and add some colors
- only 2 colors are converted for now), but it works nice for my
asterisk logs :)
Regards,
Atis
function logfile_ansi_to_html($str) {
$tokens = explode(chr(27).'[',$str);
$result = array_shift($tokens);
foreach ($tokens as $k=>$v) {
$end = 8;
$code = substr($v,0,$end);
if ($code=='0;37;40m') $result .= '</b>';
else if ($code=='1;36;40m') $result .= '<b style="color: navy">';
else if ($code=='1;35;40m') $result .= '<b style="color: #cc3366">';
else $result .= 'ANSI:'.$code;
$result .= substr($v,$end);
}
return $result;
}
--
Atis Lezdins,
VoIP Project Manager / Developer,
IQ Labs Inc,
atis at iq-labs.net
Skype: atis.lezdins
Cell Phone: +371 28806004
Cell Phone: +1 800 7300689
Work phone: +1 800 7502835
More information about the asterisk-users
mailing list