Re: [PATCH] in log entries, print hook name first

[email protected] (Robert Spier)
Newsgroups perl.qpsmtpd
Message-ID <CAAroffftCHXW8A+aD4bWUMTM2sn74JAwzZK1dZyRfGSM5u2N7Q@mail.gmail.com>
I think I like the concept, I'm concerned about backwards compatibility
with people who have written log parsers.  I was going to just apply it,
but ... it doesn't apply cleanly to the head of the tree, so I'm going to
skip it for now.  Please re-sync and add an entry to Changes.

Thanks!

-R

On Sun, May 6, 2012 at 11:27 AM, Matt Simerson <[email protected]> wrote:

> in log entries, print hook name first, so log entries look like this:
>
> 86553 (connect) ident::geoip: US, United States
> 86553 (connect) ident::p0f: Windows 7 or 8
> 86553 (connect) check_earlytalker: remote host said nothing spontaneous,
> proceeding
>
> instead of this:
>
> 86553 ident::geoip: (connect): US, United States
> 86553 ident::p0f: (connect) Windows 7 or 8
> 86553 check_earlytalker: (connect): remote host said nothing spontaneous,
> proceeding
> ---
> lib/Qpsmtpd.pm       |    6 +++---
> plugins/logging/warn |    6 +++---
> 2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/lib/Qpsmtpd.pm b/lib/Qpsmtpd.pm
> index 5d23211..a7b2a43 100644
> --- a/lib/Qpsmtpd.pm
> +++ b/lib/Qpsmtpd.pm
> @@ -132,9 +132,9 @@ sub varlog {
>    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):" : '';
> +    my $prefix = defined $plugin && defined $hook ? " ($hook) $plugin:" :
> +                 defined $plugin ? " $plugin:" :
> +                 defined $hook   ? " ($hook) running plugin:" : '';
>
>    warn join(' ', $$ . $prefix, @log), "\n";
> }
> diff --git a/plugins/logging/warn b/plugins/logging/warn
> index 9d5dd73..ce41b49 100644
> --- a/plugins/logging/warn
> +++ b/plugins/logging/warn
> @@ -32,9 +32,9 @@ sub hook_logging {
>
>    return DECLINED if $trace > $self->{_level};
>
> -    my $prefix = defined $plugin && defined $hook ? " $plugin plugin
> ($hook):" :
> -                 defined $plugin ? " $plugin plugin:" :
> -                 defined $hook   ? " running plugin ($hook):" : '';
> +    my $prefix = defined $plugin && defined $hook ? " ($hook) $plugin:" :
> +                 defined $plugin ? " $plugin:" :
> +                 defined $hook   ? " ($hook) running plugin:" : '';
>
>    warn join(' ', $$ . $prefix, @log), "\n";
>
> --
> 1.7.9.6
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.