X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FLXDebug.pm;h=17009ddcf04179ef9ae226cedba6d18d1f4706c3;hb=bb8964ddfc59e40b62f6e65f5dd38cea9b7323d0;hp=d01caa1a94f2f8ebcf060863ea6917ad6a68a93a;hpb=7274f9c8e8c61b00ff7a4e2bad6accec85015a73;p=kivitendo-erp.git diff --git a/SL/LXDebug.pm b/SL/LXDebug.pm index d01caa1a9..17009ddcf 100644 --- a/SL/LXDebug.pm +++ b/SL/LXDebug.pm @@ -119,7 +119,7 @@ sub leave_sub { my ($dummy1, $self_filename, $self_line) = caller(0); my $indent = " " x --$self->{"calldepth"}; - my $time = $self->want_request_timer ? $self->get_request_time : ''; + my $time = $self->want_request_timer ? $self->get_request_time || '' : ''; if (!defined($package)) { $self->_write('sub' . $level, $indent . "/ $time top-level?\n"); @@ -157,7 +157,7 @@ sub warn { } sub dump { - my ($self, $level, $name, $variable) = @_; + my ($self, $level, $name, $variable, %options) = @_; if ($data_dumper_available) { my $password; @@ -168,7 +168,10 @@ sub dump { my $dumper = Data::Dumper->new([$variable]); $dumper->Sortkeys(1); - $self->message($level, "dumping ${name}:\n" . $dumper->Dump()); + $dumper->Indent(2); + $dumper->$_($options{$_}) for keys %options; + my $output = $dumper->Dump(); + $self->message($level, "dumping ${name}:\n" . $output); $variable->{password} = $password if (defined $password); @@ -179,10 +182,14 @@ sub dump { keys %{ $variable }; } + return $output; + } else { $self->message($level, "dumping ${name}: Data::Dumper not available; " . "variable cannot be dumped"); + + return undef; } } @@ -292,9 +299,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 { @@ -340,11 +347,11 @@ __END__ =head1 NAME -LXDebug - Lx-Office debugging facilities +LXDebug - kivitendo debugging facilities =head1 SYNOPSIS -This module provides functions for debugging Lx-Office. An instance is +This module provides functions for debugging kivitendo. An instance is always created as the global variable C<$::lxdebug> at the earliest possible moment. @@ -418,7 +425,7 @@ Shortcut for C. =head1 CONFIGURATION C gets its configuration from the C<[debug]> section of -the C configuration file. The available options +the C configuration file. The available options are: =over 4 @@ -453,32 +460,6 @@ following would not trigger a change: # This does trigger: $::form->{some_hash} = { something => 'else' }; -=item C - -A boolean (C<1> or C<0>). If turned on then certain debug facilities -are available from the v1 menu. These include e.g. - -=over 6 - -=item * - -restarting the FastCGI process by forcefully exiting after the -request, - -=item * - -enabling and disabling function tracing, - -=item * - -enabling and disabling certain debug levels. - -=back - -Note that these are only useful if Lx-Office is running as a FastCGI -application because otherwise the changes would be lost when the -process exits in a normal CGI environment. - =item C A boolean (C<1> or C<0>). If turned on then certain temporary files