X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXLog.pm;h=44abd5b6a6a73acf0798b969fae6ca21d0adec69;hb=ad7e69f78ee4c0593e1d7576a7c1fd3b13931f84;hp=607630853b3a0de108a32c65c3c86f9a716afa61;hpb=aaf98478dc930b9d337c85c41316a926046d7ae2;p=spider.git diff --git a/perl/DXLog.pm b/perl/DXLog.pm index 60763085..44abd5b6 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; @@ -39,10 +39,7 @@ use Carp; 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; -$main::build += $VERSION; -$main::branch += $BRANCH; +($VERSION, $BRANCH) = dxver(q$Revision$); use vars qw($log); @@ -99,7 +96,7 @@ sub open $fh->autoflush(1) if $mode ne 'r'; # make it autoflushing if writable $self->{fh} = $fh; -# DXDebug::dbg("opening $self->{fn}\n") if isdbg("dxlog"); +# print "opening $self->{fn}\n"; return $self->{fh}; } @@ -155,7 +152,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} $!"; } @@ -204,6 +201,12 @@ sub Log $log->writeunix($t, join('^', $t, @_) ); } +sub LogDbg +{ + DXDebug::dbg($_) for @_; + Log(@_); +} + sub Logclose { $log->close();