commit f30fa3d: [Minor] Improve logging

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Jun 2 12:14:09 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-06-02 13:12:10 +0100
URL: https://github.com/rspamd/rspamd/commit/f30fa3d32c2635e8cbc93dadb713a8ad74007d52 (HEAD -> master)

[Minor] Improve logging

---
 src/libmime/mime_encoding.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/libmime/mime_encoding.c b/src/libmime/mime_encoding.c
index a44eb755c..5b67aec65 100644
--- a/src/libmime/mime_encoding.c
+++ b/src/libmime/mime_encoding.c
@@ -460,8 +460,16 @@ rspamd_mime_text_part_utf8_convert (struct rspamd_task *task,
 		return FALSE;
 	}
 
-	msg_info_task ("converted from %s to UTF-8 inlen: %d, outlen: %d (%d UTF16 chars)",
-			charset, input->len, r, uc_len);
+	if (text_part->mime_part && text_part->mime_part->ct) {
+		msg_info_task ("converted text part from %s ('%T' announced) to UTF-8 inlen: %d, outlen: %d (%d UTF16 chars)",
+				charset, &text_part->mime_part->ct->charset, input->len, r, uc_len);
+	}
+	else {
+		msg_info_task ("converted text part from %s (no charset announced) to UTF-8 inlen: %d, "
+				 "outlen: %d (%d UTF16 chars)",
+				charset, input->len, r, uc_len);
+	}
+
 	text_part->utf_raw_content = rspamd_mempool_alloc (task->task_pool,
 			sizeof (*text_part->utf_raw_content) + sizeof (gpointer) * 4);
 	text_part->utf_raw_content->data = d;


More information about the Commits mailing list