Applied with commented out section removed. +#if ( $hook =~ /^auth/i ) { +#warn sprintf( "run_hooks called by %s, %s, %s\n", (caller) ); +#};
On Sun, May 6, 2012 at 1:55 PM, Matt Simerson <m...@tnpi.net> wrote: > --- > lib/Qpsmtpd.pm | 30 ++++++++++++++++++------------ > plugins/logging/warn | 17 +++++++++-------- > 2 files changed, 27 insertions(+), 20 deletions(-) > > diff --git a/lib/Qpsmtpd.pm b/lib/Qpsmtpd.pm > index dbbd2a0..5d23211 100644 > --- a/lib/Qpsmtpd.pm > +++ b/lib/Qpsmtpd.pm > @@ -125,17 +125,18 @@ sub varlog { > > $self->load_logging; # in case we don't have this loaded yet > > - my ($rc) = $self->run_hooks_no_respond("logging", $trace, $hook, > $plugin, @log); > - > - unless ( $rc and $rc == DECLINED or $rc == OK ) { > - # no logging plugins registered so fall back to STDERR > - warn join(" ", $$ . > - (defined $plugin && defined $hook ? " $plugin plugin ($hook):" : > - defined $plugin ? " $plugin plugin:" : > - defined $hook ? " running plugin ($hook):" : ""), > - @log), "\n" > - if $trace <= $TraceLevel; > - } > + my ($rc) = $self->run_hooks_no_respond("logging", $trace, $hook, > $plugin, @log) > + or return; > + > + return if $rc == DECLINED || $rc == OK; # plugin success > + return if $trace > $TraceLevel; > + > + # no logging plugins registered, fall back to STDERR > + my $prefix = defined $plugin && defined $hook ? " $plugin plugin > ($hook):" : > + defined $plugin ? " $plugin plugin:" : > + defined $hook ? " running plugin ($hook):" : ''; > + > + warn join(' ', $$ . $prefix, @log), "\n"; > } > > sub clear_config_cache { > @@ -415,6 +416,9 @@ sub transaction { return {}; } # base class implements > empty transaction > > sub run_hooks { > my ($self, $hook) = (shift, shift); > +#if ( $hook =~ /^auth/i ) { > +#warn sprintf( "run_hooks called by %s, %s, %s\n", (caller) ); > +#}; > if ($hooks->{$hook}) { > my @r; > my @local_hooks = @{$hooks->{$hook}}; > @@ -515,7 +519,9 @@ sub hook_responder { > my ($self, $hook, $msg, $args) = @_; > > #my $t1 = $SAMPLER->("hook_responder", undef, 1); > - > +#if ( $hook =~ /^auth/i ) { > +#warn sprintf( "hook_responder called by %s, %s, %s\n", (caller) ); > +#}; > my $code = shift @$msg; > > my $responder = $hook . '_respond'; > diff --git a/plugins/logging/warn b/plugins/logging/warn > index 204ffdb..d62997b 100644 > --- a/plugins/logging/warn > +++ b/plugins/logging/warn > @@ -28,16 +28,17 @@ sub hook_logging { > # Don't log your own log entries! If this is the only logging plugin > # then these lines will not be logged at all. You can safely comment > # out this line and it will not cause an infinite loop. > - return DECLINED if defined $plugin and $plugin eq $self->plugin_name; > + return DECLINED if defined $plugin && $plugin eq $self->plugin_name; > > - warn > - join(" ", $$ . > - (defined $plugin ? " $plugin plugin:" : > - defined $hook ? " running plugin ($hook):" : ""), > - @log), "\n" > - if ($trace <= $self->{_level}); > + return DECLINED if $trace > $self->{_level}; > > - return DECLINED; > + my $prefix = defined $plugin && defined $hook ? " $plugin plugin > ($hook):" : > + defined $plugin ? " $plugin plugin:" : > + defined $hook ? " running plugin ($hook):" : ''), > + > + warn join(' ', $$ . $prefix, @log), "\n"; > + > + return DECLINED; > } > > =head1 NAME > -- > 1.7.9.6 > >