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 1895481952; Wed, 18 Jan 2023 17:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1674064491; bh=rqwTA3lXcapb9PRR7pGelGYaYDOkBSF5Ng+BN8L1QKo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EhUJotDjVHaevcuqanUWBnOJ3YgWH0EpGwsJDIeJc3LT8SqNUzu03Pc6D9+65orTd ViJA05srFEXdzDCpW60mfqivulaQl//sV7PBA71JaN8b/KtIwizkm9BgrTuo75koky LfqHyE0XLOa+mmY+BN2FS3DN9dAZMDM+MyugP/HkGM0wMHunoQTM/UKH3ehset+MRa KKr7wEu/x6nvh2ZWArtQcy04eGmJlvq5kh2Xw5vPWZMprlVIcUBlFDxIXUjk3n4A++ DlNgRcEveGhoMQn/muuSc0dPY2/mfT/IpKAT1V7KIzHtm02VizZXj/Cn/GhlmBlIXh Se45jtFB87m/w== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v2 17/17] cleanup: Remove the custom logger module Date: Thu, 19 Jan 2023 00:53:56 +0700 Message-Id: <20230118175356.1853-18-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: We don't need this custom logger anymore since we already use the built-in `logging` and use .conf file. Signed-off-by: Muhammad Rizki --- daemon/logger/__init__.py | 1 - daemon/logger/log.py | 52 --------------------------------------- 2 files changed, 53 deletions(-) delete mode 100644 daemon/logger/__init__.py delete mode 100644 daemon/logger/log.py diff --git a/daemon/logger/__init__.py b/daemon/logger/__init__.py deleted file mode 100644 index bb3145a..0000000 --- a/daemon/logger/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .log import BotLogger diff --git a/daemon/logger/log.py b/daemon/logger/log.py deleted file mode 100644 index 8382404..0000000 --- a/daemon/logger/log.py +++ /dev/null @@ -1,52 +0,0 @@ -import logging -import os -from enums import Platform - - -class BotLogger(logging.Logger): - - def __init__( - self, - platform: Platform = Platform.TELEGRAM, - level: int = logging.WARNING - ) -> None: - - self.platform = str(platform.value) - self.level = level - - plat_rep = self.platform.replace("discord", "dscord") - self.file_name = f"{plat_rep}/" \ - f"{os.getenv('STORAGE_DIR', 'storage')}/" \ - f"{self.platform}.log" - - self.file_fmt = "{" \ - "'time': '%(asctime)s'," \ - "'func': '%(name)s: %(funcName)s'," \ - "'path': '%(pathname)s'," \ - "'level': '%(levelname)s'," \ - "'msg': '%(message)s'"\ - "}" - - self.stream_fmt = "%(asctime)s | " \ - "%(name)s: %(funcName)s | " \ - "%(levelname)s | " \ - "%(message)s" - - - def init(self): - super().__init__(self.platform, self.level) - - file_handler = logging.FileHandler(self.file_name) - stream_handler = logging.StreamHandler() - - file_fmtr = logging.Formatter(self.file_fmt) - stream_fmtr = logging.Formatter(self.stream_fmt) - - file_handler.setFormatter(file_fmtr) - stream_handler.setFormatter(stream_fmtr) - - file_handler.setLevel(logging.WARNING) - self.setLevel(logging.INFO) - - self.addHandler(file_handler) - self.addHandler(stream_handler) -- Muhammad Rizki