- dbg("dxlog", "closing $self->{fn}\n");
- undef $self->{fh} if defined $self->{fh};
-}
+ delete $logs{$self};
+ undef $self->{fh}; # close the filehandle
+ delete $self->{fh} if $self->{fh};
+}
+
+sub flushall
+{
+ foreach my $l (values %logs) {
+ $l->{fh}->flush if exists $l->{fh};
+ }
+}
+
+# log something in the system log
+# this routine is exported to any module that declares DXLog
+# it takes all its args and joins them together with the unixtime writes them out as one line
+# The user is responsible for making sense of this!
+sub Log
+{
+ my $t = time;
+ $log->writeunix($t, join('^', $t, @_) );
+}
+
+sub LogDbg
+{
+ DXDebug::dbg($_) for @_;
+ Log(@_);
+}
+
+sub Logclose
+{
+ $log->close();
+}