[Bio] / FigKernelPackages / Tracer.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/Tracer.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.41, Wed Mar 15 21:59:29 2006 UTC revision 1.42, Wed Mar 29 19:41:02 2006 UTC
# Line 275  Line 275 
275  of a keyword, the value is separated from the option name by an equal sign. You  of a keyword, the value is separated from the option name by an equal sign. You
276  can see this last in the command-line example above.  can see this last in the command-line example above.
277    
278    You can specify a different default trace level by setting C<$options->{trace}>
279    prior to calling this method.
280    
281  An example at this point would help. Consider, for example, the command-line utility  An example at this point would help. Consider, for example, the command-line utility
282  C<TransactFeatures>. It accepts a list of positional parameters plus the options  C<TransactFeatures>. It accepts a list of positional parameters plus the options
283  C<safe>, C<noAlias>, C<start>, and C<tblFiles>. To start up this command, we execute  C<safe>, C<noAlias>, C<start>, and C<tblFiles>. To start up this command, we execute
# Line 314  Line 317 
317  need to be added in the future, they can be processed by this method without  need to be added in the future, they can be processed by this method without
318  upsetting the command-line utilities.  upsetting the command-line utilities.
319    
320    If the C<background> option is specified on the command line, then the
321    standard and error outputs will be directed to files in the temporary
322    directory, using the same suffix as the trace file. So, if the command
323    line specified
324    
325        -user=Bruce -background
326    
327    then the trace output would go to C<traceBruce.log>, the standard output to
328    C<outBruce.log>, and the error output to C<errBruce.log>. This is designed to
329    simplify starting a command in the background.
330    
331  Finally, if the special option C<-h> is specified, the option names will  Finally, if the special option C<-h> is specified, the option names will
332  be traced at level 0 and the program will exit without processing.  be traced at level 0 and the program will exit without processing.
333  This provides a limited help capability. For example, if the user enters  This provides a limited help capability. For example, if the user enters
# Line 380  Line 394 
394      $options->{sql} = [0, "turn on SQL tracing"];      $options->{sql} = [0, "turn on SQL tracing"];
395      $options->{h} = [0, "display command-line options"];      $options->{h} = [0, "display command-line options"];
396      $options->{user} = [$$, "trace log file name suffix"];      $options->{user} = [$$, "trace log file name suffix"];
397        $options->{background} = [0, "spool standard and error output"];
398      # Create a parsing hash from the options hash. The parsing hash      # Create a parsing hash from the options hash. The parsing hash
399      # contains the default values rather than the default value      # contains the default values rather than the default value
400      # and the description. While we're at it, we'll memorize the      # and the description. While we're at it, we'll memorize the
# Line 394  Line 409 
409      }      }
410      # Parse the command line.      # Parse the command line.
411      my ($retOptions, @retParameters) = ParseCommand(\%parseOptions, @argv);      my ($retOptions, @retParameters) = ParseCommand(\%parseOptions, @argv);
412        # Get the logfile suffix.
413        my $suffix = $retOptions->{user};
414        # Check for background mode.
415        if ($retOptions->{background}) {
416            my $outFileName = "$FIG_Config::temp/out$suffix.log";
417            my $errFileName = "$FIG_Config::temp/err$suffix.log";
418            open STDOUT, ">$outFileName";
419            open STDERR, ">$errFileName";
420        }
421      # Now we want to set up tracing. First, we need to know if SQL is to      # Now we want to set up tracing. First, we need to know if SQL is to
422      # be traced.      # be traced.
423      my @cats = @{$categories};      my @cats = @{$categories};
# Line 407  Line 431 
431      my $cats = join(" ", $parseOptions{trace}, @cats);      my $cats = join(" ", $parseOptions{trace}, @cats);
432      # Verify that we can open a file in the temporary directory.      # Verify that we can open a file in the temporary directory.
433      my $traceMode = "TEXT";      my $traceMode = "TEXT";
     my $suffix = $retOptions->{user};  
434      my $traceFileName = "$FIG_Config::temp/trace$suffix.log";      my $traceFileName = "$FIG_Config::temp/trace$suffix.log";
435      if (open TESTTRACE, ">$traceFileName") {      if (open TESTTRACE, ">$traceFileName") {
436          $traceMode = "+>$traceFileName";          $traceMode = "+>$traceFileName";

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.42

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3