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 2002/01/31 11:23:41 UTC

[patch] add -option to change the default tracing level

We have the functionality of changing the default tracing level for a 
long time, but no command line interface. The new -trace=new_level 
option provides this interface.

Index: Apache-Test/lib/Apache/TestRun.pm
===================================================================
RCS file: 
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestRun.pm,v
retrieving revision 1.85
diff -u -r1.85 TestRun.pm
--- Apache-Test/lib/Apache/TestRun.pm	16 Jan 2002 17:05:20 -0000	1.85
+++ Apache-Test/lib/Apache/TestRun.pm	31 Jan 2002 10:22:59 -0000
@@ -24,7 +24,7 @@
  my @std_run      = qw(start-httpd run-tests stop-httpd);
  my @others       = qw(verbose configure clean help ssl http11);
  my @flag_opts    = (@std_run, @others);
-my @string_opts  = qw(order);
+my @string_opts  = qw(order trace);
  my @ostring_opts = qw(proxy ping);
  my @debug_opts   = qw(debug);
  my @num_opts     = qw(times);
@@ -53,6 +53,7 @@
     'http11'          => 'run all tests with HTTP/1.1 (keep alive) 
requests',
     'ssl'             => 'run tests through ssl',
     'proxy'           => 'proxy requests (default proxy is localhost)',
+   'trace=T'         => 'change tracing default to: warning, notice, 
info, debug, ...',
     (map { $_, "\U$_\E url" } @request_opts),
  );

@@ -207,6 +208,18 @@
      if (exists $opts{debug}) {
          $opts{debugger} = $opts{debug};
          $opts{debug} = 1;
+    }
+
+    if ($opts{trace}) {
+        my %levels = map {$_ => 1} @Apache::TestTrace::Levels;
+        if (exists $levels{ $opts{trace} }) {
+            $Apache::TestTrace::Level = $opts{trace};
+        }
+        else {
+            error "unknown trace level: $opts{trace}",
+                "valid levels are: @Apache::TestTrace::Levels";
+            exit_perl 0;
+        }
      }

      # breakpoint automatically turns the debug mode on

_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/