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)