[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.11, Mon Jun 13 09:34:52 2005 UTC revision 1.12, Thu Jun 23 23:21:09 2005 UTC
# Line 45  Line 45 
45  C<< TSetup('3 errors Sprout ERDB', 'HTML'); >>  C<< TSetup('3 errors Sprout ERDB', 'HTML'); >>
46    
47  sets the trace level to 3, activates the C<errors>, C<Sprout>, and C<ERDB> categories, and  sets the trace level to 3, activates the C<errors>, C<Sprout>, and C<ERDB> categories, and
48  specifies that messages should be output as HTML paragraphs. The parameters are formatted  specifies that messages should be output as HTML paragraphs.
49  a little clumsily, but it makes them easier to input on a web form or in a query URL.  
50    To turn on tracing for ALL categories, use an asterisk. The call below sets every category to
51    level 3 and writes the output to the standard error output. This sort of thing might be
52    useful in a CGI environment.
53    
54    C<< TSetup('3 *', 'WARN'); >>
55    
56  In addition to HTML and file output for trace messages, you can specify that the trace messages  In addition to HTML and file output for trace messages, you can specify that the trace messages
57  be queued. The messages can then be retrieved by calling the L</QTrace> method. This approach  be queued. The messages can then be retrieved by calling the L</QTrace> method. This approach
# Line 105  Line 110 
110  my @Queue = ();                         # queued list of trace messages.  my @Queue = ();                         # queued list of trace messages.
111  my $LastCategory = "main";  # name of the last category interrogated  my $LastCategory = "main";  # name of the last category interrogated
112  my $SetupCount = 0;         # number of times TSetup called  my $SetupCount = 0;         # number of times TSetup called
113    my $AllTrace = 0;           # TRUE if we are tracing all categories.
114    
115  =head2 Public Methods  =head2 Public Methods
116    
# Line 147  Line 153 
153          my @categoryData = split /\s+/, $categoryList;          my @categoryData = split /\s+/, $categoryList;
154          # Extract the trace level.          # Extract the trace level.
155          $TraceLevel = shift @categoryData;          $TraceLevel = shift @categoryData;
156          # Build the category hash.      # Presume category-based tracing until we learn otherwise.
157        $AllTrace = 0;
158        # Build the category hash. Note that if we find a "*", we turn on non-category
159        # tracing.
160          for my $category (@categoryData) {          for my $category (@categoryData) {
161            if ($category eq '*') {
162                $AllTrace = 1;
163            } else {
164                  $Categories{$category} = 1;                  $Categories{$category} = 1;
165          }          }
166        }
167          # Now we need to process the destination information. The most important special          # Now we need to process the destination information. The most important special
168          # cases are the single ">", which requires we clear the file first, and the          # cases are the single ">", which requires we clear the file first, and the
169          # "+" prefix which indicates a double echo.          # "+" prefix which indicates a double echo.
# Line 706  Line 719 
719                  my ($category, $traceLevel) = @_;                  my ($category, $traceLevel) = @_;
720                  if (!defined $traceLevel) {                  if (!defined $traceLevel) {
721                          # Here we have no category, so we need to get the calling package.                          # Here we have no category, so we need to get the calling package.
722                # The calling package is normally the first parameter. If it is
723                # omitted, the first parameter will be the tracelevel. So, the
724                # first thing we do is shift the so-called category into the
725                # $traceLevel variable where it belongs.
726                          $traceLevel = $category;                          $traceLevel = $category;
727                          my ($package, $fileName, $line) = caller;                          my ($package, $fileName, $line) = caller;
728              # If there is no calling package, we default to "main".              # If there is no calling package, we default to "main".
# Line 718  Line 735 
735          # Save the category name.          # Save the category name.
736          $LastCategory = $category;          $LastCategory = $category;
737                  # Use the category and tracelevel to compute the result.                  # Use the category and tracelevel to compute the result.
738                  $retVal = ($traceLevel <= $TraceLevel && exists $Categories{$category});          $retVal = ($traceLevel <= $TraceLevel && ($AllTrace || exists $Categories{$category}));
739      }      }
740          # Return the computed result.          # Return the computed result.
741      return $retVal;      return $retVal;

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3