X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=DWeather%2Flib%2FDWeather%2FDebug.pm;h=594d9372c0ee8d31911db1bf819409d2679dd686;hb=86125caccc4bf630c8db18d9377c42b1ec5da428;hp=d67b70221022d02e129858c3622c2d417f9ba5d0;hpb=b3376c44ca26ef6b330994bcbeea40d3ae9166de;p=dweather.git diff --git a/DWeather/lib/DWeather/Debug.pm b/DWeather/lib/DWeather/Debug.pm index d67b702..594d937 100644 --- a/DWeather/lib/DWeather/Debug.pm +++ b/DWeather/lib/DWeather/Debug.pm @@ -4,8 +4,6 @@ # # Copyright (c) 1998 - Dirk Koopman G1TLH # -# $Id: Debug.pm,v 1.1 2001/05/18 14:02:10 djk Exp $ -# # This library is free software; you can redistribute it and/or # modify it under the same terms as Perl itself. # @@ -13,15 +11,18 @@ package DWeather::Debug; require Exporter; + @ISA = qw(Exporter); @EXPORT = qw(dbginit dbg dbgadd dbgsub dbglist dbgdump isdbg dbgclose confess croak cluck carp); -$VERSION = sprintf( "%d.%02d", q$Revision: 1.1 $ =~ /(\d+)\.(\d+)/ ); +$VERSION = 1.23; use strict; use vars qw(%dbglevel $fp); +use 5.01001; -use DWeather::Logger; +use SMGLog (); use Carp qw(cluck); +use Time::HiRes qw(gettimeofday); %dbglevel = (); $fp = undef; @@ -52,16 +53,18 @@ if (!defined $DB::VERSION) { ); } +dbginit(); + sub dbg { - my $t = time; - my $ts = sprintf("%02d:%02d:%02d", (gmtime($t))[2,1,0]); + my ($t,$ut) = gettimeofday; + my $ts = sprintf "%02d:%02d:%02d:%03d", (gmtime($t))[2,1,0], $ut/1000; for (@_) { my $r = $_; chomp $r; my @l = split /\n/, $r; for (@l) { - s/([\x00-\x1f\x7f-\xff])/uc sprintf("%%%02x",ord($1))/eg; + s/([\x00-\x08\x0B-\x1f\x7f-\xff])/uc sprintf("%%%02x",ord($1))/eg; # print "$_\n" if defined \*STDOUT; $fp->writeunix($t, "$ts $_"); } @@ -76,7 +79,7 @@ sub dbginit $SIG{__DIE__} = sub { dbg($@, Carp::longmess(@_)); }; } - $fp = DWeather::Logger->new('debug', 'log', 'd') unless $fp; + $fp = SMGLog->new('debug', 'log', 'd'); } sub dbgclose