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 [175.158.50.43]) by gnuweeb.org (Postfix) with ESMTPSA id C54AD81952; Wed, 18 Jan 2023 17:54:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1674064465; bh=rZmMJuNEB1Mw04nJGRHe+KgWFvJ0N63qyFnOGK6bdxA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X4LpJc0zwefD/TxfoM+PV+f/nb3sI0EFewr91W1yhaCfE4+Srhj2qXrAOfBUy+NbD Eo6zXLbC62QbQZDs0DkVQfKI6Tp1quCFkB5UIDjzzlRZQoEyS3wSlJABwdPvyBw2tf zL6Fd6bKhIRkOTG+bp3jxwuo9F+gNgGxcSRMnhFfp28DxQ8q1n1JAFLToyf8YX5jOB vZU72ajfnsxjEE24rFV0cK3Pm2XMbZXHBD/uhqZJafUbKDkN4S7hBT5gQGNQv9iaJ+ tHz0GIWOSN3okomkjZH4plfjDjsCDaHGFjuu/T/aYEdGIlW0ELfam/aQ7r2DOyM0Xa 9FrUD1AxuclYw== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v2 05/17] telegram: logger: Initialize the configuration for the Telegram logger. Date: Thu, 19 Jan 2023 00:53:44 +0700 Message-Id: <20230118175356.1853-6-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20230118175356.1853-1-kiizuha@gnuweeb.org> References: <20230118175356.1853-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: This commit adds the configuration for the logger and sets the logger level of other loggers, such as pyrogram, to the WARNING level. Changing the level is to disable some of their log messages, so that only our bot logs to the console. Signed-off-by: Muhammad Rizki --- daemon/tg.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/daemon/tg.py b/daemon/tg.py index 6b2ec20..26f8374 100644 --- a/daemon/tg.py +++ b/daemon/tg.py @@ -14,6 +14,8 @@ from telegram.mailer import BotMutexes from telegram.mailer import Bot from logger import BotLogger import os +import logging +import logging.config def main(): @@ -22,6 +24,10 @@ def main(): logger = BotLogger() logger.init() + logging.config.fileConfig("telegram/telegram.logger.conf") + logging.getLogger("apscheduler").setLevel(logging.WARNING) + logging.getLogger("pyrogram").setLevel(logging.WARNING) + client = DaemonTelegram( "telegram/storage/EmailScraper", api_id=int(os.getenv("API_ID")), -- Muhammad Rizki