[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.43, Mon Apr 24 21:05:17 2006 UTC revision 1.44, Wed Apr 26 17:57:00 2006 UTC
# Line 344  Line 344 
344          -start    start with this genome          -start    start with this genome
345          -tblFiles output TBL files containing the corrected IDs          -tblFiles output TBL files containing the corrected IDs
346    
347    The caller has the option of modifying the tracing scheme by placing a value
348    for C<trace> in the incoming options hash. The default value can be overridden,
349    or the tracing to the standard output can be turned off by suffixing a minus
350    sign to the trace level. So, for example,
351    
352        { trace => [0, "tracing level (default 0)"],
353           ...
354    
355    would set the default trace level to 0 instead of 2, while
356    
357        { trace => ["2-", "tracing level (default 2)"],
358           ...
359    
360    would leave the default at 2, but trace only to the log file, not to the
361    standard output.
362    
363  The parameters to this method are as follows.  The parameters to this method are as follows.
364    
365  =over 4  =over 4
# Line 361  Line 377 
377  by specifying the options as command-line switches prefixed by a hyphen.  by specifying the options as command-line switches prefixed by a hyphen.
378  Tracing-related options may be added to this hash. If the C<-h> option is  Tracing-related options may be added to this hash. If the C<-h> option is
379  specified on the command line, the option descriptions will be used to  specified on the command line, the option descriptions will be used to
380  explain the options.  explain the options. To turn off tracing to the standard output, add a
381    minus sign to the value for C<trace> (see above).
382    
383  =item parmHelp  =item parmHelp
384    
385  A string that vaguely describes the positional parameters. This is used  A string that vaguely describes the positional parameters. This is used
386  if the user specifies the C<-h> option.  if the user specifies the C<-h> option.
387    
388  =item ARGV  =item argv
389    
390  List of command line parameters, including the option switches, which must  List of command line parameters, including the option switches, which must
391  precede the positional parameters and be prefixed by a hyphen.  precede the positional parameters and be prefixed by a hyphen.
# Line 426  Line 443 
443      }      }
444      # Add the default categories.      # Add the default categories.
445      push @cats, "Tracer", "FIG";      push @cats, "Tracer", "FIG";
446      # Next, we create the category string by prefixing the trace level      # Next, we create the category string by joining the categories.
447      # and joining the categories.      my $cats = join(" ", @cats);
448      my $cats = join(" ", $parseOptions{trace}, @cats);      # Check to determine whether or not the caller wants to turn off tracing
449      # Verify that we can open a file in the temporary directory.      # to the standard output.
450      my $traceMode = "TEXT";      my $traceLevel = $retOptions->{trace};
451        my $textOKFlag = 1;
452        if ($traceLevel =~ /^(.)-/) {
453            $traceLevel = $1;
454            $textOKFlag = 0;
455        }
456        # Now we set up the trace mode.
457        my $traceMode;
458        # Verify that we can open a file in the FIG temporary directory.
459      my $traceFileName = "$FIG_Config::temp/trace$suffix.log";      my $traceFileName = "$FIG_Config::temp/trace$suffix.log";
460      if (open TESTTRACE, ">$traceFileName") {      if (open TESTTRACE, ">$traceFileName") {
461          $traceMode = "+>$traceFileName";          # Here we can trace to a file.
462            $traceMode = ">$traceFileName";
463            if ($textOKFlag) {
464                # Echo to standard output if the text-OK flag is set.
465                $traceMode = "+$traceMode";
466            }
467            # Close the test file.
468          close TESTTRACE;          close TESTTRACE;
469        } else {
470            # Here we can't trace to a file. We trace to the standard output if it's
471            # okay, and the error log otherwise.
472            if ($textOKFlag) {
473                $traceMode = "TEXT";
474            } else {
475                $traceMode = "WARN";
476            }
477      }      }
478      # Now set up the tracing.      # Now set up the tracing.
479      TSetup($cats, $traceMode);      TSetup("$traceLevel $cats", $traceMode);
480      # Check for the "h" option. If it is specified, dump the command-line      # Check for the "h" option. If it is specified, dump the command-line
481      # options and exit the program.      # options and exit the program.
482      if ($retOptions->{h}) {      if ($retOptions->{h}) {

Legend:
Removed from v.1.43  
changed lines
  Added in v.1.44

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3