Currently there are two tracing mechanisms used in Apache::Test, the
on/off turning if which is not consistent. This patch replaces the ->trace
calls with Apache::TestTrace::info().
This patch makes things consistent through using the Apache::TestTrace log
levels.
I suppose that by default the "log" level should be 'warning' and TestRun
should change the loglevel to 'info' if called with -verbose. Because
with this patch there is too much noise (since 'info' is the default log
level).
Index: Apache-Test/lib/Apache/TestConfig.pm
===================================================================
RCS file:
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm,v
retrieving revision 1.118
diff -u -r1.118 TestConfig.pm
--- Apache-Test/lib/Apache/TestConfig.pm 31 Dec 2001 06:39:30 -0000
1.118
+++ Apache-Test/lib/Apache/TestConfig.pm 31 Dec 2001 07:26:56 -0000
@@ -544,7 +544,7 @@
for (@trys) {
my $file = catfile $_, $module;
if (-e $file) {
- $self->trace("found $module => $file");
+ info "found $module => $file";
return $file;
}
}
@@ -623,7 +623,7 @@
sub genfile_trace {
my($self, $file) = @_;
my $name = abs2rel $file, $self->{vars}->{t_dir};
- $self->trace("generating $name");
+ info "generating $name";
}
sub genfile_warning {
@@ -730,11 +730,11 @@
for (keys %{ $self->{clean}->{files} }) {
if (-e $_) {
- $self->trace("unlink $_");
+ info "unlink $_";
unlink $_;
}
else {
- $self->trace("unlink $_: $!");
+ info "unlink $_: $!";
}
}
@@ -747,7 +747,7 @@
my $notempty = grep { ! /^\.{1,2}$/ } readdir $dh;
closedir $dh;
next if $notempty;
- $self->trace("rmdir $_");
+ info "rmdir $_";
rmdir $_;
}
}
@@ -1138,12 +1138,6 @@
#utils
-sub trace {
- my $self = shift;
- return unless $self->{verbose};
- print "@_\n";
-}
-
#duplicating small bits of Apache::Build so we dont require it
sub which {
foreach (map { catfile $_, $_[0] } File::Spec->path) {
@@ -1244,7 +1238,7 @@
my $file = catfile $self->{vars}->{t_conf}, "$name.pm";
my $fh = $self->genfile($file);
- $self->trace("saving config data to $name.pm");
+ info "saving config data to $name.pm";
(my $obj = $self->freeze) =~ s/^/ /;
Index: Apache-Test/lib/Apache/TestConfigParse.pm
===================================================================
RCS file:
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigParse.pm,v
retrieving revision 1.18
diff -u -r1.18 TestConfigParse.pm
--- Apache-Test/lib/Apache/TestConfigParse.pm 19 Dec 2001 23:20:55 -0000
1.18
+++ Apache-Test/lib/Apache/TestConfigParse.pm 31 Dec 2001 07:26:56 -0000
@@ -5,6 +5,9 @@
use strict;
use warnings FATAL => 'all';
+
+use Apache::TestTrace;
+
use File::Spec::Functions qw(rel2abs splitdir);
use File::Basename qw(basename);
@@ -84,14 +87,14 @@
my $file = $self->server_file_rel2abs($args->[1]);
unless (-e $file) {
- $self->trace("$file does not exist, skipping LoadModule");
+ info "$file does not exist, skipping LoadModule";
next;
}
my $name = basename $args->[1];
$name =~ s/\.s[ol]$/.c/; #mod_info.so => mod_info.c
$name =~ s/^lib/mod_/; #libphp4.so => mod_php4.c
- $self->trace("LoadModule $modname $name");
+ info "LoadModule $modname $name";
$name = $modname_alias{$name} if $modname_alias{$name};
$self->{modules}->{$name} = 1;
@@ -147,7 +150,7 @@
return unless $file;
- $self->trace("inheriting config file: $file");
+ info "inheriting config file: $file";
my $fh = Symbol::gensym();
open($fh, $file) or return;
Index: Apache-Test/lib/Apache/TestConfigPerl.pm
===================================================================
RCS file:
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigPerl.pm,v
retrieving revision 1.43
diff -u -r1.43 TestConfigPerl.pm
--- Apache-Test/lib/Apache/TestConfigPerl.pm 20 Dec 2001 03:51:11 -0000
1.43
+++ Apache-Test/lib/Apache/TestConfigPerl.pm 31 Dec 2001 07:26:56 -0000
@@ -35,7 +35,7 @@
else {
my $msg = "unable to locate $libname\n";
$cfg = "#$msg";
- $self->trace($msg);
+ info $msg;
}
$self->preamble(IfModule => '!mod_perl.c', $cfg);
}
@@ -302,7 +302,7 @@
$handler =~ s/response//i; #s/PerlResponseHandler/PerlHandler/
}
- $self->trace("configuring $module");
+ info "configuring $module";
if (my $cv = $add_hook_config{$hook}) {
$self->$cv($module, [EMAIL PROTECTED]);
Index: Apache-Test/lib/Apache/TestServer.pm
===================================================================
RCS file:
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestServer.pm,v
retrieving revision 1.46
diff -u -r1.46 TestServer.pm
--- Apache-Test/lib/Apache/TestServer.pm 20 Dec 2001 17:30:54 -0000
1.46
+++ Apache-Test/lib/Apache/TestServer.pm 31 Dec 2001 07:26:56 -0000
@@ -23,10 +23,6 @@
strace => 'strace',
);
-sub trace {
- shift->{config}->trace(@_);
-}
-
sub new {
my $class = shift;
my $config = shift;
@@ -65,7 +61,7 @@
for (@apache_logs) {
my $file = catfile $dir, $_;
if (unlink $file) {
- $self->trace("unlink $file");
+ info "unlink $file";
}
}
}
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/