From dca872388d6c05b3380acfb9bc5d1ccefa8f9494 Mon Sep 17 00:00:00 2001 From: Stoiko Ivanov Date: Wed, 22 May 2019 17:31:52 +0200 Subject: [PATCH] limit precision of bayes-score in log Spamassassin's bayes_score is a float, and is written to the log during filtering. Limiting the precision for the log to 2 decimal places keeps logs a bit shorter and also prevents misreadings of values like: 5.55111571207834e-17 Signed-off-by: Stoiko Ivanov --- PMG/RuleDB/Spam.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PMG/RuleDB/Spam.pm b/PMG/RuleDB/Spam.pm index feda0f3..97a80b3 100644 --- a/PMG/RuleDB/Spam.pm +++ b/PMG/RuleDB/Spam.pm @@ -421,8 +421,8 @@ sub analyze_spam { $sa_max = $status->get_required_score(); $autolearn = $status->get_autolearn_status(); - $bayes = defined($status->{bayes_score}) ? - $status->{bayes_score} : "undefined"; + $bayes = defined($status->{bayes_score}) ? + sprintf('%0.2f', $status->{bayes_score}) : "undefined"; my $salist = $status->get_names_of_tests_hit(); -- 2.39.2