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:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Reply via email to