Ignore:
Timestamp:
2001-09-26T10:43:44+12:00 (23 years ago)
Author:
jrm21
Message:

import.pl now takes an option for saving file conversion failures to a log.
By default, import.pl will use <collectdir>/etc/fail.log. Currently only
the plugins based on ConvertToPlug will do this. Not yet tested on Win9X.

Location:
trunk/gsdl/perllib/plugins
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/plugins/BasPlug.pm

    r2751 r2755  
    175175sub init {
    176176    my $self = shift (@_);
    177     my ($verbosity, $outhandle) = @_;
     177    my ($verbosity, $outhandle, $faillogname) = @_;
    178178
    179179    # verbosity is passed through from the processor
     
    182182    # as is the outhandle ...
    183183    $self->{'outhandle'} = $outhandle if defined $outhandle;
     184    $self->{'faillogname'} = $faillogname;
    184185
    185186    # set process_exp and block_exp to defaults unless they were
  • trunk/gsdl/perllib/plugins/ConvertToPlug.pm

    r2751 r2755  
    168168    print $outhandle "Converting $tailname$suffix to $convert_to format\n";
    169169    }
     170
     171    my $errlog = &util::filename_cat($tmp_dirname, "err.log");
    170172   
    171173    # Execute the conversion command and get the type of the result,
    172174    # making sure the converter gives us the appropriate output type
    173175    my $output_type = lc($convert_to);
    174     my $cmd = "perl -S gsConvert.pl -verbose $verbosity -output $output_type \"$tmp_filename\"";
     176    my $cmd = "perl -S gsConvert.pl -verbose $verbosity -errlog \"$errlog\" -output $output_type \"$tmp_filename\"";
    175177    $output_type = `$cmd`;
    176178
     
    182184    if ($output_type eq "fail") {
    183185    print $outhandle "Could not convert $tailname$suffix to $convert_to format\n";
     186    if ($self->{'faillogname'} ne "" && -s "$errlog") {
     187        open(SAVELOG, ">>$self->{'faillogname'}");
     188        open(ERRLOG, "$errlog");
     189        print SAVELOG "$tailname$suffix (converting to $convert_to) failed:\n";
     190        while (<ERRLOG>) {
     191        print SAVELOG "$_";
     192        }
     193        close ERRLOG;
     194        print SAVELOG "\n";
     195        close SAVELOG;
     196    }
     197    &util::rm("$errlog") if (-e "$errlog");
    184198    return "";
    185199    }
Note: See TracChangeset for help on using the changeset viewer.