add logging of PC92A ip addresses
[spider.git] / perl / DXLog.pm
index 607630853b3a0de108a32c65c3c86f9a716afa61..171b9373d9dacf379ed2bbe802049bb6760413bf 100644 (file)
 # 
 # Copyright (c) - 1998 Dirk Koopman G1TLH
 #
-# $Id$
+#
 #
 
 package DXLog;
 
 require Exporter;
 @ISA = qw(Exporter);
-@EXPORT = qw(Log Logclose);
+@EXPORT = qw(Log LogDbg Logclose);
 
 use IO::File;
 use DXVars;
@@ -38,12 +38,6 @@ 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;
-
 use vars qw($log);
 
 $log = new('log', 'dat', 'm');
@@ -99,7 +93,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 +149,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 +198,12 @@ sub Log
        $log->writeunix($t, join('^', $t, @_) );
 }
 
+sub LogDbg
+{
+       DXDebug::dbg($_) for @_;
+       Log(@_);
+}
+
 sub Logclose
 {
        $log->close();