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 C6FDB81914; Tue, 17 Jan 2023 22:12:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1673993567; bh=5lBYrFuSN7sdSOOR2uqnX5fkeMdoSMcPtIrfXRiX8uI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sb9WtBUrfofpfVVvQ7BqgswWzd+KUVS/zgGwqjK+bqNTJflgHDwhS5jrxC2TZUsI3 DHDTos7z2e8HK50V7PPprTR2HFq3dBPnOztmxhe+ZqCtrMsCmULo7cJ+SiflRtVRIP 4SeKOkb9erCUvs8/0HcLcWRh7ZlAh1Xnh2xO5WaKWBLQQjvP9JFSpP3HUQVvx9V8vs GNAlFXSkdI5JLOu9EQRYDD0nbwmaOwyJq0Fd9yCPfJpd69amtzb33uVXdgRuKhCW7D YGycY43uZZHVHV7mDyrFGDp2EuX+rr5PzciJJc4qTHHs4nH3g7Q1i53Rl9z0qaIhcm wG4jgX0s2UzLw== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v1 03/15] telegram: logger: Add a telegram.logger.conf Date: Wed, 18 Jan 2023 05:12:04 +0700 Message-Id: <20230117221216.1783-4-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: Add a logger configuration file for improved configuration, debugging, and management. This method is cleaner than before and the BotLogger() will be removed in the future. Signed-off-by: Muhammad Rizki --- daemon/telegram/telegram.logger.conf | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 daemon/telegram/telegram.logger.conf diff --git a/daemon/telegram/telegram.logger.conf b/daemon/telegram/telegram.logger.conf new file mode 100644 index 0000000..d0c0de3 --- /dev/null +++ b/daemon/telegram/telegram.logger.conf @@ -0,0 +1,36 @@ +[loggers] +keys=root,telegram + +[handlers] +keys=consoleHandler,fileHandler + +[formatters] +keys=sampleFormatter,dictFormatter + +[logger_root] +level=INFO +handlers=consoleHandler,fileHandler + +[logger_telegram] +level=INFO +handlers=consoleHandler +qualname=telegram +propagate=0 + +[handler_consoleHandler] +class=StreamHandler +level=INFO +formatter=sampleFormatter +args=(sys.stdout,) + +[handler_fileHandler] +class=FileHandler +level=WARNING +formatter=dictFormatter +args=("telegram/storage/telegram.log",) + +[formatter_sampleFormatter] +format=%(asctime)s - %(name)s: %(funcName)s - %(levelname)s - %(message)s + +[formatter_dictFormatter] +format={"time": "%(asctime)s", "func": "%(name)s: %(funcName)s", "path": "%(pathname)s", "level": "%(levelname)s", "msg": "%(message)s"} -- Muhammad Rizki