Browse Source

[Minor] Reduce debug level verbosity

pull/5547/head
Vsevolod Stakhov 4 months ago
parent
commit
e989261050
No known key found for this signature in database GPG Key ID: 7647B6790081437
  1. 8
      src/libstat/backends/redis_backend.cxx
  2. 40
      src/libstat/classifiers/bayes.c

8
src/libstat/backends/redis_backend.cxx

@ -152,13 +152,13 @@ public:
return false;
}
msg_debug_bayes("processing tokens for statfile id=%d, results size=%uz, class=%s",
id, results->size(), stcf->class_name ? stcf->class_name : "unknown");
if (results->size() > 0) {
msg_debug_bayes("processing %uz tokens for statfile id=%d, class=%s",
results->size(), id, stcf->class_name ? stcf->class_name : "unknown");
}
for (auto [idx, val]: *results) {
tok = (rspamd_token_t *) g_ptr_array_index(tokens, idx - 1);
msg_debug_bayes("setting tok->values[%d] = %.2f for token idx %d (class=%s)",
id, val, idx, stcf->class_name ? stcf->class_name : "unknown");
tok->values[id] = val;
}

40
src/libstat/classifiers/bayes.c

@ -229,36 +229,7 @@ bayes_classify_token(struct rspamd_classifier *ctx,
token_type = "meta";
}
if (tok->t1 && tok->t2) {
msg_debug_bayes("token(%s) %uL <%*s:%*s>: weight: %f, cf: %f, "
"total_count: %ud, "
"spam_count: %ud, ham_count: %ud,"
"spam_prob: %.3f, ham_prob: %.3f, "
"bayes_spam_prob: %.3f, bayes_ham_prob: %.3f, "
"current spam probability: %.3f, current ham probability: %.3f",
token_type,
tok->data,
(int) tok->t1->stemmed.len, tok->t1->stemmed.begin,
(int) tok->t2->stemmed.len, tok->t2->stemmed.begin,
fw, w, total_count, spam_count, ham_count,
spam_prob, ham_prob,
bayes_spam_prob, bayes_ham_prob,
cl->spam_prob, cl->ham_prob);
}
else {
msg_debug_bayes("token(%s) %uL <?:?>: weight: %f, cf: %f, "
"total_count: %ud, "
"spam_count: %ud, ham_count: %ud,"
"spam_prob: %.3f, ham_prob: %.3f, "
"bayes_spam_prob: %.3f, bayes_ham_prob: %.3f, "
"current spam probability: %.3f, current ham probability: %.3f",
token_type,
tok->data,
fw, w, total_count, spam_count, ham_count,
spam_prob, ham_prob,
bayes_spam_prob, bayes_ham_prob,
cl->spam_prob, cl->ham_prob);
}
/* Per-token debug logging removed to reduce verbosity */
}
}
@ -347,14 +318,7 @@ bayes_classify_token_multiclass(struct rspamd_classifier *ctx,
cl->text_tokens++;
}
if (tok->t1 && tok->t2) {
msg_debug_bayes("token(%s) %uL <%*s:%*s>: weight: %.3f, total_count: %ud, "
"processed for %ud classes",
token_type, tok->data,
(int) tok->t1->stemmed.len, tok->t1->stemmed.begin,
(int) tok->t2->stemmed.len, tok->t2->stemmed.begin,
fw, total_count, cl->num_classes);
}
/* Per-token debug logging removed to reduce verbosity */
}
}

Loading…
Cancel
Save