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.112.71]) by gnuweeb.org (Postfix) with ESMTPSA id 2875F7E52E; Tue, 17 Jan 2023 22:12:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1673993571; bh=rZmMJuNEB1Mw04nJGRHe+KgWFvJ0N63qyFnOGK6bdxA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VVXjStQKVIXnHIkZhLnyy2tmXRqNF766bVCBRqRt/Dthidg8eLzQ1/Vi90nyRCbIC xDBVwYNbO4pBIafyi3XlOEHCw0kIw+SdMD93Una9v8mgYtLMCoiOOYVkBJJWnHunSY FoLiihbpvugaz0Z4VeLIOfmWxFPytBNToaGgBd3WlVmjLWYKylcSZnRjs+5k0ZqUbm TdYwIn7XLP7/KvuTHmWV0CVwXEdFDgIV8Fg96wzM+ceYayIKjihYOyv/ZiLiEvyGBM 8SWOcTJm0y1jaYfM3/XCQCBeFc4Ekr5Xl75EKcYPnzLuX/NNsGjQFCClm/u7qtiYBj SBsm/KEuvjJ4Q== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v1 05/15] telegram: logger: Initialize the configuration for the Telegram logger. Date: Wed, 18 Jan 2023 05:12:06 +0700 Message-Id: <20230117221216.1783-6-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20230117221216.1783-1-kiizuha@gnuweeb.org> References: <20230117221216.1783-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