From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NO_DNS_FOR_FROM,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from localhost.localdomain (unknown [101.128.125.209]) by gnuweeb.org (Postfix) with ESMTPSA id C53F9819D2; Wed, 21 Dec 2022 01:34:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1671586466; bh=bFp6gn7xXCbzoWdWZMwjArCYIgJzIVtmlsfn1vcKo0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tA/U+TaC7w8tFIiUzKeyUjcR+XJ86aS4pY5UZ+x6AJSsZNjg+XWy7vPUsV4ZmfdmW WBTDlLT+Odt4A6cqXW3BmXgeLnwP+KthJeY2NK5tc5PCaIYpxLvdW1sPIX7FeBxhEY UUvxLYSntLa8NKZLk9xOMFzokIiCy000fOtGqFyam4oI3fTMf6SdDlotp6MeAjAl9c Z8IQd5A0WxibiRJnlprBLDINJ+2rBKcEJGJnTVqdXP4xf8c7lu/DSQzT/BqrHFY9fq tfupA+hPvAuGSP0I7QWjG6E5ZYhOQrxiWCvPOZqMkxbGMt7q5Jam4mAv0+MexuEorx hZfLMcz3SXS9w== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v4 07/17] utils: Add catch_err() for the log message Date: Wed, 21 Dec 2022 08:33:37 +0700 Message-Id: <20221221013347.1704-8-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20221221013347.1704-1-kiizuha@gnuweeb.org> References: <20221221013347.1704-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Add catch_err() for the logger message in the future use. Signed-off-by: Muhammad Rizki --- daemon/atom/utils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/daemon/atom/utils.py b/daemon/atom/utils.py index 1502687..7e41674 100644 --- a/daemon/atom/utils.py +++ b/daemon/atom/utils.py @@ -296,6 +296,12 @@ def get_decoded_payload(payload: Message): return p.encode().decode(charset, errors="replace") +def catch_err(): + return traceback.format_exc() \ + .encode("unicode_escape") \ + .decode("utf-8") + + EMAIL_MSG_ID_PATTERN = r"<([^\<\>]+)>" def extract_email_msg_id(msg_id): ret = re.search(EMAIL_MSG_ID_PATTERN, msg_id) -- Muhammad Rizki