X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXLog.pm;h=8e2fc66febaa2021d06fa641bc8771cace0d9708;hb=3ba4a53a0fae7b6135ee9b8cd0ab4bbe352b4bdc;hp=dde723027f5b237afd735c4452eeafd1b7a42a02;hpb=9a55af9586711ecdea8dc9b0da38509119fa8090;p=spider.git diff --git a/perl/DXLog.pm b/perl/DXLog.pm index dde72302..8e2fc66f 100644 --- a/perl/DXLog.pm +++ b/perl/DXLog.pm @@ -27,7 +27,7 @@ package DXLog; require Exporter; @ISA = qw(Exporter); -@EXPORT = qw(Log); +@EXPORT = qw(Log Logclose); use FileHandle; use DXVars; @@ -75,7 +75,7 @@ sub open $mode = 'r' if !$mode; $self->{mode} = $mode; - my $fh = new FileHandle $self->{fn}, $mode; + my $fh = new FileHandle $self->{fn}, $mode, 0666; return undef if !$fh; $fh->autoflush(1) if $mode ne 'r'; # make it autoflushing if writable $self->{fh} = $fh; @@ -174,10 +174,8 @@ sub Log $log->writeunix($t, join('^', $t, @_) ); } -sub DESTROY # catch undefs and do what is required further down the tree +sub Logclose { - my $self = shift; - DXDebug::dbg("dxlog", "closing $self->{fn}\n"); - undef $self->{fh} if defined $self->{fh}; -} + $log->close(); +} 1;