X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FLXDebug.pm;h=2f80caccda5fd4e76d6349d851052d19c6fc9034;hb=bf8db146f807d3f374334f9b91671d32592c5974;hp=895b3f266c8c39cd739668efd89fd7966baa1be5;hpb=874a3b3d92d11e941545ed6307091cd3408358d2;p=kivitendo-erp.git diff --git a/SL/LXDebug.pm b/SL/LXDebug.pm index 895b3f266..2f80caccd 100644 --- a/SL/LXDebug.pm +++ b/SL/LXDebug.pm @@ -9,8 +9,9 @@ use constant TRACE => 1 << 4; use constant BACKTRACE_ON_ERROR => 1 << 5; use constant REQUEST_TIMER => 1 << 6; use constant WARN => 1 << 7; -use constant ALL => (1 << 8) - 1; -use constant DEVEL => INFO | QUERY | TRACE | BACKTRACE_ON_ERROR | REQUEST_TIMER; +use constant TRACE2 => 1 << 8; +use constant ALL => (1 << 9) - 1; +use constant DEVEL => INFO | DEBUG1 | QUERY | TRACE | BACKTRACE_ON_ERROR | REQUEST_TIMER; use constant FILE_TARGET => 0; use constant STDERR_TARGET => 1; @@ -88,7 +89,7 @@ sub enter_sub { my $level = shift || 0; return 1 unless ($global_level & TRACE); # ignore if traces aren't active - return 1 if $level && !($global_level & $level); # ignore if level of trace isn't active + return 1 if $level && !($global_level & TRACE2); # ignore if level of trace isn't active my ($package, $filename, $line, $subroutine) = caller(1); my ($dummy1, $self_filename, $self_line) = caller(0); @@ -112,7 +113,7 @@ sub leave_sub { my $level = shift || 0; return 1 unless ($global_level & TRACE); # ignore if traces aren't active - return 1 if $level && !($global_level & $level); # ignore if level of trace isn't active + return 1 if $level && !($global_level & TRACE2); # ignore if level of trace isn't active my ($package, $filename, $line, $subroutine) = caller(1); my ($dummy1, $self_filename, $self_line) = caller(0); @@ -261,7 +262,7 @@ sub _write { chomp($message); if ((FILE_TARGET == $self->{"target"}) - && open(FILE, ">>" . $self->{"file"})) { + && open(FILE, ">>", $self->{"file"})) { print(FILE "${date}${message}\n"); close(FILE); @@ -291,9 +292,9 @@ sub end_request { } sub log_time { - my $self = shift; + my ($self, @slurp) = @_; return 1 unless want_request_timer(); - $self->_write("time", $self->get_request_time); + $self->_write("time", $self->get_request_time() . (@slurp ? " (@slurp)" : '')); } sub get_request_time { @@ -382,7 +383,15 @@ Log all queries executed by the L utility methods. =item C -Log sub calls and exits via the L/L functions. +Log sub calls and exits via the L/L functions, +but only if they're called with a log level that is falsish +(e.g. none, C, 0). + +=item C + +Log sub calls and exits via the L/L functions +even if they're called with a log level of 2. Will only have an effect +if C is set as well. =item C @@ -495,8 +504,8 @@ Pairs of these can be put near the beginning/end of a sub. They'll cause a trace to be written to the log file if the C level is active. -If C<$level> is given then the log messages will only be logged if an -additional log level C<$level> is active as well. +If C<$level> is given then the log messages will only be logged if the +global log level C is active as well. =item C