From d0b97c33be4329451ff3d799096667c8599edc26 Mon Sep 17 00:00:00 2001 From: Karako Date: Sun, 2 Apr 2023 20:48:27 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20some=20bugs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pg_logger/_config.py | 2 +- src/pg_logger/_handler.py | 2 +- src/pg_logger/_logger.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pg_logger/_config.py b/src/pg_logger/_config.py index ea56b1d..9c68a62 100644 --- a/src/pg_logger/_config.py +++ b/src/pg_logger/_config.py @@ -33,7 +33,7 @@ class LoggerConfig(BaseSettings): debug: bool = False """是否 debug""" - width: int = 180 + width: Optional[int] = None """输出时的宽度""" keywords: List[str] = [] """高亮的关键字""" diff --git a/src/pg_logger/_handler.py b/src/pg_logger/_handler.py index 49563a0..1eadaa0 100644 --- a/src/pg_logger/_handler.py +++ b/src/pg_logger/_handler.py @@ -127,7 +127,7 @@ class Handler(DefaultRichHandler): def __init__( self, *args, - width: int = None, + width: Optional[int] = None, rich_tracebacks: bool = True, locals_max_depth: Optional[int] = None, tracebacks_max_frames: int = 100, diff --git a/src/pg_logger/_logger.py b/src/pg_logger/_logger.py index 9eb1913..f0eaf44 100644 --- a/src/pg_logger/_logger.py +++ b/src/pg_logger/_logger.py @@ -97,7 +97,7 @@ class Logger(logging.Logger): datefmt=self.config.time_format, handlers=[handler, debug_handler, error_handler], ) - if config.capture_warnings: + if self.config.capture_warnings: logging.captureWarnings(True) warnings_logger = logging.getLogger("py.warnings") warnings_logger.addHandler(handler)