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

Diff of /FigKernelPackages/FIG.pm

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

revision 1.525, Wed Sep 27 13:39:16 2006 UTC revision 1.526, Mon Oct 2 02:56:39 2006 UTC
# Line 152  Line 152 
152  also be invoked dynamically. This is a general artifact of the  also be invoked dynamically. This is a general artifact of the
153  way PERL implements object-oriented programming.  way PERL implements object-oriented programming.
154    
 =head2 Tracing  
   
 The FIG object supports tracing using the B<Tracer> module. If tracing is  
 inactive when the FIG object is constructed, it will call B<TSetup> using  
 parameters specified either in the environment variables or in the  
 C<FIG_Config> module. Most command-line tools should call B<TSetup> before  
 constructing a FIG object so that the tracing configuration can be specified  
 as command-line options. If the prior call to B<TSetup> has not occurred,  
 then the environment variables C<Trace> and C<TraceType> will be examined.  
 If those do not exist, the global variables I<$FIG_Config::trace_levels> and  
 I<$FIG_Config::trace_type> will be used.  
   
 C<Trace> and I<$FIG_Config::trace_type> specify the tracing level and categories.  
 Only tracing calls for the specified categories with a level less than or equal  
 to the trace level will be displayed. The higher the trace level or the more  
 the categories, the more messages will be displayed. For example, the  
 following Unix command will set up for tracing at level 3 for the categories  
 C<SQL> and C<Sprout>.  
   
     export Trace="3 SQL Sprout"  
   
 In most cases, the category names is the same as the name of the Perl package  
 from which the trace call was made. An asterisk (C<*>) can be used to turn on  
 tracing for all categories.  
   
     export Trace="2 *"  
   
 turns on tracing at level 2 for everything.  
   
 C<TraceType> and C<$FIG_Config::trace_type> determine where the tracing is going  
 to show up. A full treatment of all the options can be found in the documentation  
 for the B<Tracer> module. The most common options, however, are C<WARN>, which  
 converts all trace messages to warnings, and C<TEXT>, which writes them to the  
 standard output. The default is C<WARN>, the theory being that this is the best  
 option during web page construction. If you are operating from a command line  
 rather than a web page, you will probably want to do  
   
     export TraceType="TEXT"  
   
 to get tracing in the standard output. An alternative is  
   
     export TraceType="+>~fig/FIG/Tmp/trace.log"  
   
 which writes tracing to the standard output and copies it into the C<trace.log>  
 file in the C<~fig/FIG/Tmp> directory.  
   
155  =head2 Hiding/Caching in a FIG object  =head2 Hiding/Caching in a FIG object
156    
157  We save the DB handle, cache taxonomies, and put a few other odds and ends in the  We save the DB handle, cache taxonomies, and put a few other odds and ends in the
# Line 245  Line 199 
199          my $figrpc = new FIGrpc($ENV{FIG_URL});          my $figrpc = new FIGrpc($ENV{FIG_URL});
200          return $figrpc;          return $figrpc;
201      }      }
     # Here we have the normal case. Check for default tracing. We only do this if  
     # the proper parameters are present and nobody else has set up tracing yet.  
     if (Tracer::Setups() == 0 && (defined $FIG_Config::trace_levels || exists $ENV{Trace})) {  
         # Tracing is not active and the user has specified tracing levels, so it's safe for  
         # us to set it up using our own rules. First, the trace type: the default is WARN.  
         my $trace_type;  
         if (exists($ENV{TraceType})) {  
             $trace_type = $ENV{TraceType};  
         } elsif (defined($FIG_Config::trace_type)) {  
             $trace_type = $FIG_Config::trace_type;  
         } else {  
             $trace_type = "WARN";  
         }  
         # Now the trace levels. The environment variable wins over the FIG_Config value.  
         my $trace_levels = (exists($ENV{Trace}) ? $ENV{Trace} : $FIG_Config::trace_levels);  
         TSetup($trace_levels, $trace_type);  
     }  
202      Trace("Connecting to the database.") if T(2);      Trace("Connecting to the database.") if T(2);
203      # Connect to the database, then return ourselves.      # Connect to the database, then return ourselves.
204      my $rdbH = new DBrtns;      my $rdbH = new DBrtns;

Legend:
Removed from v.1.525  
changed lines
  Added in v.1.526

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3