Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision edbbcd58

Von Moritz Bunkus vor mehr als 13 Jahren hinzugefügt

  • ID edbbcd58bbc9e042771b68510b3986f826d195d9
  • Vorgänger ad9811f4
  • Nachfolger af281b3c

enter_sub(2)/leave_sub(2) nur loggen, wenn TRACE2 als Log-Level gesetzt ist

Bisher wurde das Argument als normales Log-Level interpretiert, was
DEBUG1 entsprach. Das ist aber unintuitiv und macht es relativ
sinnlos, DEBUG1 zu benutzen, weil es zusammen mit TRACE plötzlich alle
enter_sub(2)/leave_sub(2)-Calls mit angezeigt hat.

Unterschiede anzeigen:

SL/LXDebug.pm
9 9
use constant BACKTRACE_ON_ERROR =>  1 << 5;
10 10
use constant REQUEST_TIMER      =>  1 << 6;
11 11
use constant WARN               =>  1 << 7;
12
use constant ALL                => (1 << 8) - 1;
13
use constant DEVEL              => INFO | QUERY | TRACE | BACKTRACE_ON_ERROR | REQUEST_TIMER;
12
use constant TRACE2             =>  1 << 8;
13
use constant ALL                => (1 << 9) - 1;
14
use constant DEVEL              => INFO | DEBUG1 | QUERY | TRACE | BACKTRACE_ON_ERROR | REQUEST_TIMER;
14 15

  
15 16
use constant FILE_TARGET   => 0;
16 17
use constant STDERR_TARGET => 1;
......
88 89
  my $level = shift || 0;
89 90

  
90 91
  return 1 unless ($global_level & TRACE);          # ignore if traces aren't active
91
  return 1 if $level && !($global_level & $level);  # ignore if level of trace isn't active
92
  return 1 if $level && !($global_level & TRACE2);  # ignore if level of trace isn't active
92 93

  
93 94
  my ($package, $filename, $line, $subroutine) = caller(1);
94 95
  my ($dummy1, $self_filename, $self_line) = caller(0);
......
112 113
  my $level = shift || 0;
113 114

  
114 115
  return 1 unless ($global_level & TRACE);           # ignore if traces aren't active
115
  return 1 if $level && !($global_level & $level);   # ignore if level of trace isn't active
116
  return 1 if $level && !($global_level & TRACE2);   # ignore if level of trace isn't active
116 117

  
117 118
  my ($package, $filename, $line, $subroutine) = caller(1);
118 119
  my ($dummy1, $self_filename, $self_line) = caller(0);
......
382 383

  
383 384
=item C<TRACE>
384 385

  
385
Log sub calls and exits via the L<enter_sub>/L<leave_sub> functions.
386
Log sub calls and exits via the L<enter_sub>/L<leave_sub> functions,
387
but only if they're called with a log level that is falsish
388
(e.g. none, C<undef>, 0).
389

  
390
=item C<TRACE2>
391

  
392
Log sub calls and exits via the L<enter_sub>/L<leave_sub> functions
393
even if they're called with a log level of 2. Will only have an effect
394
if C<TRACE> is set as well.
386 395

  
387 396
=item C<BACKTRACE_ON_ERROR>
388 397

  
......
495 504
cause a trace to be written to the log file if the C<TRACE> level is
496 505
active.
497 506

  
498
If C<$level> is given then the log messages will only be logged if an
499
additional log level C<$level> is active as well.
507
If C<$level> is given then the log messages will only be logged if the
508
global log level C<TRACE2> is active as well.
500 509

  
501 510
=item C<enable_sub_tracing>
502 511

  

Auch abrufbar als: Unified diff