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 6EDE581952; Wed, 18 Jan 2023 17:54:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1674064461; bh=5lBYrFuSN7sdSOOR2uqnX5fkeMdoSMcPtIrfXRiX8uI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jzErftvs2XmDGRsEJhfoAK5Gw5CBP01aGGriiX6KoxB+APgAbnUSgvEJJE5SGkOgr CU1szjWxZSYwncETViN2CClRcSDvMLwbhPnMM7B53e1lF+veEde5PybFBwqks2h10B eK2SHJCuv2UUYFZ8i6oVL1JUpKS5C/FsC0s/Zwzox7/UbpA/tC7hyFtUr5m4cxLRiA Qzu9kh4TOqTs301f7d1gaw/5iUoKCTcDK1HYe6svHfdFuif5J5WDS+iwGTjTiXJKiW 8j8CLA0X2qcoTgfWNP+9sE7NFfbYUcOfmmqPkAHUvtBiw1r1PAEqeY7M2CNkH+mwbM 3N1lhpqAzl9mw== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v2 03/17] telegram: logger: Add a telegram.logger.conf Date: Thu, 19 Jan 2023 00:53:42 +0700 Message-Id: <20230118175356.1853-4-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: 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