Revision ffd8667e
Von Moritz Bunkus vor mehr als 14 Jahren hinzugefügt
SL/LXDebug.pm | ||
---|---|---|
14 | 14 |
use constant FILE_TARGET => 0; |
15 | 15 |
use constant STDERR_TARGET => 1; |
16 | 16 |
|
17 |
use POSIX qw(strftime); |
|
17 |
use POSIX qw(strftime getppid);
|
|
18 | 18 |
use Time::HiRes qw(gettimeofday tv_interval); |
19 | 19 |
use YAML; |
20 | 20 |
|
... | ... | |
75 | 75 |
my ($dummy1, $self_filename, $self_line) = caller(0); |
76 | 76 |
|
77 | 77 |
my $indent = " " x $self->{"calldepth"}++; |
78 |
my $time = $self->want_request_timer ? $self->get_request_time : '';
|
|
78 |
my $time = $self->get_request_time || '';
|
|
79 | 79 |
|
80 | 80 |
if (!defined($package)) { |
81 | 81 |
$self->_write('sub' . $level, $indent . "\\ $time top-level?\n"); |
... | ... | |
211 | 211 |
|
212 | 212 |
sub _write { |
213 | 213 |
my ($self, $prefix, $message) = @_; |
214 |
my $date = strftime("%Y-%m-%d %H:%M:%S $$ ${prefix}: ", localtime(time())); |
|
214 |
my $date = strftime("%Y-%m-%d %H:%M:%S $$ [" . getppid() . "] ${prefix}: ", localtime(time()));
|
|
215 | 215 |
local *FILE; |
216 | 216 |
|
217 | 217 |
chomp($message); |
... | ... | |
247 | 247 |
|
248 | 248 |
sub get_request_time { |
249 | 249 |
my $self = shift; |
250 |
tv_interval($self->{request_start});
|
|
250 |
return $self->want_request_timer && $self->{request_start} ? tv_interval($self->{request_start}) : undef;
|
|
251 | 251 |
} |
252 | 252 |
|
253 | 253 |
sub set_request_timer { |
Auch abrufbar als: Unified diff
Requests nicht timen, wenn begin_request nicht aufgerufen wurde.