You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by do...@apache.org on 2007/05/25 23:43:00 UTC

svn commit: r541787 - /spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Rule2XSBody.pm

Author: dos
Date: Fri May 25 14:42:59 2007
New Revision: 541787

URL: http://svn.apache.org/viewvc?view=rev&rev=541787
Log:
bug 5477: prevent Rule2XSBody info message from appearing on stderr during spamd startup

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Rule2XSBody.pm

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Rule2XSBody.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Rule2XSBody.pm?view=diff&rev=541787&r1=541786&r2=541787
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Rule2XSBody.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Rule2XSBody.pm Fri May 25 14:42:59 2007
@@ -70,6 +70,16 @@
   $self->setup_test_set ($conf, $conf->{body_tests}, 'body');
 }
 
+sub compile_now_start {
+  my ($self) = @_;
+  # call info here (and no earlier) so that the message appears in the syslog
+  # but not on stderr when we start spamd
+  if (exists $self->{compiled_rules_log_msg_text}) {
+    info("zoom: $self->{compiled_rules_log_msg_text}") unless (would_log('dbg', 'zoom'));
+    delete $self->{compiled_rules_log_msg_text};
+  }
+}
+
 sub setup_test_set {
   my ($self, $conf, $test_set, $ruletype) = @_;
   foreach my $pri (keys %{$test_set}) {
@@ -148,8 +158,9 @@
     my $pc_zoomed   = ($found / ($totalhasrules || .001)) * 100;
     $pc_zoomed   = int($pc_zoomed * 1000) / 1000;
 
-    info("zoom: able to use $found/$totalhasrules '$ruletype' compiled ".
-        "rules ($pc_zoomed\%)");
+    $self->{compiled_rules_log_msg_text} = "able to use $found/".
+        "$totalhasrules '$ruletype' compiled rules ($pc_zoomed\%)";
+    dbg("zoom: $self->{compiled_rules_log_msg_text}");
 
     # TODO: issue a warning for low counts?
     # TODO: inhibit rule2xs scanning entirely for low counts?