X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXLog.pm;h=785483533c562f50dfc438e30ecfebfda9cf024b;hb=24550808f9ee4ba5cf6a720bb364977f7ed586af;hp=c13e26c1d8ffac4b8c641802c1af75f1ede6643f;hpb=2b58ccdf81685a1167a43c38705a0d84b9d8d661;p=spider.git diff --git a/perl/DXLog.pm b/perl/DXLog.pm index c13e26c1..78548353 100644 --- a/perl/DXLog.pm +++ b/perl/DXLog.pm @@ -27,7 +27,7 @@ package DXLog; require Exporter; @ISA = qw(Exporter); -@EXPORT = qw(Log Logclose); +@EXPORT = qw(Log LogDbg Logclose); use IO::File; use DXVars; @@ -40,7 +40,7 @@ use strict; use vars qw($VERSION $BRANCH); $VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ ); -$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ ) || 0; +$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0)); $main::build += $VERSION; $main::branch += $BRANCH; @@ -92,15 +92,14 @@ sub open $mode = 'r' if !$mode; $self->{mode} = $mode; + $self->{jdate} = $jdate; my $fh = new IO::File $self->{fn}, $mode, 0666; return undef if !$fh; $fh->autoflush(1) if $mode ne 'r'; # make it autoflushing if writable $self->{fh} = $fh; - $self->{jdate} = $jdate; - -# DXDebug::dbg("opening $self->{fn}\n") if isdbg("dxlog"); +# print "opening $self->{fn}\n"; return $self->{fh}; } @@ -156,7 +155,7 @@ sub write($$$) if (!$self->{fh} || $self->{mode} ne ">>" || $jdate->year != $self->{jdate}->year || - $jdate->thing != $self->{jdate}->year) { + $jdate->thing != $self->{jdate}->thing) { $self->open($jdate, ">>") or confess "can't open $self->{fn} $!"; } @@ -205,6 +204,12 @@ sub Log $log->writeunix($t, join('^', $t, @_) ); } +sub LogDbg +{ + DXDebug::dbg($_[$#_]); + Log(@_); +} + sub Logclose { $log->close();