X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FLXDebug.pm;h=3a56e62a90bcfd0204f9ba6f3a1c78177ec13ee9;hb=6c9677e4fde52aae481cc004895d506812ca8d67;hp=ac7c577da53ed9b9ac7b21bb2b0bfbf870212b25;hpb=d319704a66e9be64da837ccea10af6774c2b0838;p=kivitendo-erp.git diff --git a/SL/LXDebug.pm b/SL/LXDebug.pm index ac7c577da..3a56e62a9 100644 --- a/SL/LXDebug.pm +++ b/SL/LXDebug.pm @@ -1,13 +1,13 @@ package LXDebug; -use constant { - NONE => 0, - INFO => 1, - DEBUG1 => 2, - DEBUG2 => 3, +use constant NONE => 0; +use constant INFO => 1; +use constant DEBUG1 => 2; +use constant DEBUG2 => 3; +use constant QUERY => 4; - FILE_TARGET => 0, - STDERR_TARGET => 1 }; +use constant FILE_TARGET => 0; +use constant STDERR_TARGET => 1; use POSIX qw(strftime); @@ -53,7 +53,9 @@ sub set_target { } sub enter_sub { - my ($self) = @_; + my ($self, $level) = @_; + + return if $global_trace_subs < $level; if (!$self->{"trace_subs"} && !$global_trace_subs) { return; @@ -77,7 +79,9 @@ sub enter_sub { } sub leave_sub { - my ($self) = @_; + my ($self, $level) = @_; + + return if $global_trace_subs < $level; if (!$self->{"trace_subs"} && !$global_trace_subs) { return; @@ -106,10 +110,11 @@ sub message { } if ($log_level >= $level) { - $self->_write(INFO == $level - ? "info" - : DEBUG1 == $level ? "debug1" : "debug2", - $message); + $self->_write(INFO == $level ? "info" + : DEBUG1 == $level ? "debug1" + : DEBUG2 == $level ? "debug2" + : QUERY == $level ? "query":"", + $message ); } } @@ -132,7 +137,7 @@ sub enable_sub_tracing { sub disable_sub_tracing { my ($self) = @_; - $self->{"trace_subs"} = 1; + $self->{"trace_subs"} = 0; } sub _write {