projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed duplicate spot, always make clean ending
[spider.git]
/
perl
/
DXLog.pm
diff --git
a/perl/DXLog.pm
b/perl/DXLog.pm
index ede817aa446fdae1dc89ae634488401206bc74d5..db7dffdd430a0977e306fa83d0afcff4ee671e95 100644
(file)
--- a/
perl/DXLog.pm
+++ b/
perl/DXLog.pm
@@
-34,7
+34,7
@@
use DXVars;
use DXUtil;
use Julian;
use DXUtil;
use Julian;
-use Carp;
+use Carp
qw(confess cluck)
;
use strict;
use strict;
@@
-56,7
+56,8
@@
sub new
# make sure the directory exists
mkdir($ref->{prefix}, 0777) unless -e $ref->{prefix};
$logs{$ref} = $ref;
# make sure the directory exists
mkdir($ref->{prefix}, 0777) unless -e $ref->{prefix};
$logs{$ref} = $ref;
-
+ $ref->{jdate} = $ref->unixtoj($main::systime);
+
return $ref;
}
return $ref;
}
@@
-148,10
+149,14
@@
sub unixtoj($$)
sub write($$$)
{
my ($self, $jdate, $line) = @_;
sub write($$$)
{
my ($self, $jdate, $line) = @_;
+ cluck("Log::write \$jdate undefined") unless $jdate;
+# cluck("Log::write \$self->jdate undefined") unless $self->{jdate};
if (!$self->{fh} ||
if (!$self->{fh} ||
- $self->{mode} ne ">>" ||
- $jdate->year != $self->{jdate}->year ||
- $jdate->thing != $self->{jdate}->thing) {
+ $self->{mode} ne ">>" ||
+ $jdate->year !=
+ $self->{jdate}->year ||
+ $jdate->thing
+ != $self->{jdate}->thing) {
$self->open($jdate, ">>") or confess "can't open $self->{fn} $!";
}
$self->open($jdate, ">>") or confess "can't open $self->{fn} $!";
}
@@
-183,14
+188,6
@@
sub close
delete $self->{fh};
}
delete $self->{fh};
}
-sub DESTROY
-{
- my $self = shift;
- delete $logs{$self};
- undef $self->{fh}; # close the filehandle
- delete $self->{fh} if $self->{fh};
-}
-
sub flushall
{
foreach my $l (values %logs) {
sub flushall
{
foreach my $l (values %logs) {
@@
-204,7
+201,7
@@
sub flushall
# The user is responsible for making sense of this!
sub Log
{
# The user is responsible for making sense of this!
sub Log
{
- my $t = time;
+ my $t =
$main::sys
time;
$log->writeunix($t, join('^', $t, @_) );
}
$log->writeunix($t, join('^', $t, @_) );
}