[PATCH] in log entries, print hook name first

[email protected] (Matt Simerson)
Newsgroups perl.qpsmtpd
Message-ID <[email protected]>
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.