[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.86, Fri May 18 19:27:17 2007 UTC revision 1.91, Mon Aug 20 23:07:05 2007 UTC
# Line 1185  Line 1185 
1185      # Get the timestamp.      # Get the timestamp.
1186      my $timeStamp = Now();      my $timeStamp = Now();
1187      # Format the message. Note we strip off any line terminators at the end.      # Format the message. Note we strip off any line terminators at the end.
1188      my $formatted = "[$timeStamp] <$LastCategory>: " . Strip($message);      my $prefix = "[$timeStamp] <$LastCategory>: ";
1189        my $formatted = $prefix . Strip($message);
1190      # Process according to the destination.      # Process according to the destination.
1191      if ($Destination eq "TEXT") {      if ($Destination eq "TEXT") {
1192          # Write the message to the standard output.          # Write the message to the standard output.
# Line 1199  Line 1200 
1200      } elsif ($Destination eq "HTML") {      } elsif ($Destination eq "HTML") {
1201          # Convert the message to HTML and write it to the standard output.          # Convert the message to HTML and write it to the standard output.
1202          my $escapedMessage = CGI::escapeHTML($message);          my $escapedMessage = CGI::escapeHTML($message);
1203          print "<p>$formatted</p>\n";          print "<p>$timeStamp $LastCategory: $escapedMessage</p>\n";
1204      } elsif ($Destination eq "WARN") {      } elsif ($Destination eq "WARN") {
1205         # Emit the message as a warning.         # Emit the message as a warning.
1206         warn $message;         warn $message;
# Line 1264  Line 1265 
1265              if (!$package) {              if (!$package) {
1266                  $category = "main";                  $category = "main";
1267              } else {              } else {
1268                  $category = $package;                  my @cats = split /::/, $package;
1269                    $category = $cats[$#cats];
1270              }              }
1271          }          }
1272          # Save the category name.          # Save the category name.
# Line 1772  Line 1774 
1774  sub Confess {  sub Confess {
1775      # Get the parameters.      # Get the parameters.
1776      my ($message) = @_;      my ($message) = @_;
1777        if (! defined($FIG_Config::no_tool_hdr)) {
1778            # Here we have a tool header. Display its length so that the user can adjust the line numbers.
1779            my $toolHeaderFile = "$FIG_Config::fig_disk/dist/releases/current/$FIG_Config::arch/tool_hdr";
1780            # Only proceed if the tool header file is actually present.
1781            if (-f $toolHeaderFile) {
1782                my @lines = GetFile($toolHeaderFile);
1783                Trace("Tool header has " . scalar(@lines) . " lines.");
1784            }
1785        }
1786      # Trace the call stack.      # Trace the call stack.
1787      Cluck($message);      Cluck($message);
1788      # Abort the program.      # Abort the program.
# Line 2583  Line 2594 
2594    
2595  =head3 Insure  =head3 Insure
2596    
2597  C<< Insure($dirName); >>  C<< Insure($dirName, $chmod); >>
2598    
2599  Insure a directory is present.  Insure a directory is present.
2600    
# Line 2593  Line 2604 
2604    
2605  Name of the directory to check. If it does not exist, it will be created.  Name of the directory to check. If it does not exist, it will be created.
2606    
2607    =item chmod (optional)
2608    
2609    Security privileges to be given to the directory if it is created.
2610    
2611  =back  =back
2612    
2613  =cut  =cut
2614    
2615  sub Insure {  sub Insure {
2616      my ($dirName) = @_;      my ($dirName, $chmod) = @_;
2617      if (! -d $dirName) {      if (! -d $dirName) {
2618          Trace("Creating $dirName directory.") if T(File => 2);          Trace("Creating $dirName directory.") if T(2);
2619          eval { mkpath $dirName; };          eval {
2620                mkpath $dirName;
2621                # If we have permissions specified, set them here.
2622                if (defined($chmod)) {
2623                    chmod $chmod, $dirName;
2624                }
2625            };
2626          if ($@) {          if ($@) {
2627              Confess("Error creating $dirName: $@");              Confess("Error creating $dirName: $@");
2628          }          }
# Line 3175  Line 3196 
3196      return $retVal;      return $retVal;
3197  }  }
3198    
3199    
3200  1;  1;

Legend:
Removed from v.1.86  
changed lines
  Added in v.1.91

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3