You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-dev@httpd.apache.org by Stas Bekman <st...@stason.org> on 2004/02/03 03:02:49 UTC
Apache::TestTrace: changing non-coloured tracing prefices
I find that users get confused about the various tracing codes used by A-T,
since it's not necessarily clear what all these '&&&', '***', '!!!' prefices
mean and how to tell which ones are crucial errors and which ones aren't. So I
suggest to just print the level ala Apache log messages, e.g.:
% APACHE_TEST_COLOR=0 t/TEST -trace=debug
[warning] setting ulimit to allow core files
ulimit -c unlimited; /home/stas/perl/5.8.1-ithread-nouseshrplib/bin/perl5.8.1
t/TEST -trace=debug
[ debug] isolated httpd_info VERSION = Apache/2.0.49-dev
[...]
[ debug] generating conf/httpd.conf
[ debug] generating conf/apache_test_config.pm
[ debug] saving config data to apache_test_config.pm
[ error] port 8529 is in use, cannot determine server pid to shutdown
not sure whether to align to the left, right or do any alignment at all
('warning' is a 7 chars, info is only 4.)
I'd like keeping the colored output (that you get with APACHE_TEST_COLOR=1) as
it is now, since it's very convenient for us (at least for me ;), who use the
tracing all the time and know to tell the level by the colour. Adding [foo]
token prefices will just add to the clutter, IMHO.
Here is a possible patch:
Index: lib/Apache/TestTrace.pm
===================================================================
RCS file:
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestTrace.pm,v
retrieving revision 1.19
diff -u -r1.19 TestTrace.pm
--- lib/Apache/TestTrace.pm 17 Dec 2003 17:58:02 -0000 1.19
+++ lib/Apache/TestTrace.pm 3 Feb 2004 01:59:36 -0000
@@ -57,19 +57,6 @@
$colors{$_} = Term::ANSIColor::color($colors{$_});
}
}
-else {
- %colors = (
- emerg => '&&&',
- alert => '$$$',
- crit => '%%%',
- error => '!!!',
- warning => '***',
- notice => '- ',
- info => ' ',
- debug => '==>',
- todo => 'todo',
- );
-}
*expand = HAS_DUMPER ?
sub { map { ref $_ ? Data::Dumper::Dumper($_) : $_ } @_ } :
@@ -101,7 +88,7 @@
my ($level, $prefix_type) = (shift, shift);
my $prefix = prefix($prefix_type);
print $LogFH
- map { sprintf "%-3s %s%s\n", $colors{$level}, $prefix, $_ }
+ map { sprintf "[%7s] %s%s\n", $level, $prefix, $_ }
grep defined($_), expand(@_);
}
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Apache::TestTrace: changing non-coloured tracing prefices
Posted by Stas Bekman <st...@stason.org>.
Geoffrey Young wrote:
>>So it'll look like:
>>
>>[warning] setting ulimit to allow core files
>>ulimit -c unlimited;
>>/home/stas/perl/5.8.1-ithread-nouseshrplib/bin/perl5.8.1 t/TEST
>>-trace=debug
>>[debug] isolated httpd_info VERSION = Apache/2.0.49-dev
>>[...]
>>[crit] generating conf/httpd.conf
>
>
> that's really a critical message? hmm.
it wasn't a real output, just a mock-up.
>>[debug] generating conf/apache_test_config.pm
>>[todo] saving config data to apache_test_config.pm
>>[error] port 8529 is in use, cannot determine server pid to shutdown
>>
>>I prefer to have a visual alignment, but if you think the above is ok,
>>it's fine with me (I don't use non-coloured tracing anyway).
>
>
> looks good to me :)
Thanks, now committed.
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Apache::TestTrace: changing non-coloured tracing prefices
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
> So it'll look like:
>
> [warning] setting ulimit to allow core files
> ulimit -c unlimited;
> /home/stas/perl/5.8.1-ithread-nouseshrplib/bin/perl5.8.1 t/TEST
> -trace=debug
> [debug] isolated httpd_info VERSION = Apache/2.0.49-dev
> [...]
> [crit] generating conf/httpd.conf
that's really a critical message? hmm.
> [debug] generating conf/apache_test_config.pm
> [todo] saving config data to apache_test_config.pm
> [error] port 8529 is in use, cannot determine server pid to shutdown
>
> I prefer to have a visual alignment, but if you think the above is ok,
> it's fine with me (I don't use non-coloured tracing anyway).
looks good to me :)
--Geoff
Re: Apache::TestTrace: changing non-coloured tracing prefices
Posted by Stas Bekman <st...@stason.org>.
Geoffrey Young wrote:
>
> Stas Bekman wrote:
>
>>I find that users get confused about the various tracing codes used by
>>A-T, since it's not necessarily clear what all these '&&&', '***', '!!!'
>>prefices mean and how to tell which ones are crucial errors and which
>>ones aren't. So I suggest to just print the level ala Apache log
>>messages, e.g.:
>>
>>% APACHE_TEST_COLOR=0 t/TEST -trace=debug
>>[warning] setting ulimit to allow core files
>>ulimit -c unlimited;
>>/home/stas/perl/5.8.1-ithread-nouseshrplib/bin/perl5.8.1 t/TEST
>>-trace=debug
>>[ debug] isolated httpd_info VERSION = Apache/2.0.49-dev
>>[...]
>>[ debug] generating conf/httpd.conf
>>[ debug] generating conf/apache_test_config.pm
>>[ debug] saving config data to apache_test_config.pm
>>[ error] port 8529 is in use, cannot determine server pid to shutdown
>>
>>not sure whether to align to the left, right or do any alignment at all
>>('warning' is a 7 chars, info is only 4.)
>
>
> I don't think they need to be aligned. other than that, +1
So it'll look like:
[warning] setting ulimit to allow core files
ulimit -c unlimited; /home/stas/perl/5.8.1-ithread-nouseshrplib/bin/perl5.8.1
t/TEST -trace=debug
[debug] isolated httpd_info VERSION = Apache/2.0.49-dev
[...]
[crit] generating conf/httpd.conf
[debug] generating conf/apache_test_config.pm
[todo] saving config data to apache_test_config.pm
[error] port 8529 is in use, cannot determine server pid to shutdown
I prefer to have a visual alignment, but if you think the above is ok, it's
fine with me (I don't use non-coloured tracing anyway).
>>I'd like keeping the colored output (that you get with
>>APACHE_TEST_COLOR=1) as it is now, since it's very convenient for us (at
>>least for me ;), who use the tracing all the time and know to tell the
>>level by the colour. Adding [foo] token prefices will just add to the
>>clutter, IMHO.
>
>
> are you suggesting to remove all prefixes and use only colors? I absolutely
> can't stand colored terminals (of course - seems we disagree on _everything_
> now :)
> it might make sense to remove the prefixes if you have colors enabled
> (might, but probably not - users are supposed to know somehow that red is
> "more severe" than blue?) but I don't think they can be removed altogether.
No, no, I'm not suggesting that at all. We have never had any prefixes when
colours are on (and they are off by default). I suggested to fix only the
default non-coloured tracing, keeping the coloured ones as before.
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Apache::TestTrace: changing non-coloured tracing prefices
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
Stas Bekman wrote:
> I find that users get confused about the various tracing codes used by
> A-T, since it's not necessarily clear what all these '&&&', '***', '!!!'
> prefices mean and how to tell which ones are crucial errors and which
> ones aren't. So I suggest to just print the level ala Apache log
> messages, e.g.:
>
> % APACHE_TEST_COLOR=0 t/TEST -trace=debug
> [warning] setting ulimit to allow core files
> ulimit -c unlimited;
> /home/stas/perl/5.8.1-ithread-nouseshrplib/bin/perl5.8.1 t/TEST
> -trace=debug
> [ debug] isolated httpd_info VERSION = Apache/2.0.49-dev
> [...]
> [ debug] generating conf/httpd.conf
> [ debug] generating conf/apache_test_config.pm
> [ debug] saving config data to apache_test_config.pm
> [ error] port 8529 is in use, cannot determine server pid to shutdown
>
> not sure whether to align to the left, right or do any alignment at all
> ('warning' is a 7 chars, info is only 4.)
I don't think they need to be aligned. other than that, +1
>
> I'd like keeping the colored output (that you get with
> APACHE_TEST_COLOR=1) as it is now, since it's very convenient for us (at
> least for me ;), who use the tracing all the time and know to tell the
> level by the colour. Adding [foo] token prefices will just add to the
> clutter, IMHO.
are you suggesting to remove all prefixes and use only colors? I absolutely
can't stand colored terminals (of course - seems we disagree on _everything_
now :)
it might make sense to remove the prefixes if you have colors enabled
(might, but probably not - users are supposed to know somehow that red is
"more severe" than blue?) but I don't think they can be removed altogether.
--Geoff