🐛 Fix some bugs

This commit is contained in:
Karako 2023-04-02 20:48:27 +08:00
parent 81d1c1853b
commit d0b97c33be
No known key found for this signature in database
GPG Key ID: 5920831B0095D4A0
3 changed files with 3 additions and 3 deletions

View File

@ -33,7 +33,7 @@ class LoggerConfig(BaseSettings):
debug: bool = False debug: bool = False
"""是否 debug""" """是否 debug"""
width: int = 180 width: Optional[int] = None
"""输出时的宽度""" """输出时的宽度"""
keywords: List[str] = [] keywords: List[str] = []
"""高亮的关键字""" """高亮的关键字"""

View File

@ -127,7 +127,7 @@ class Handler(DefaultRichHandler):
def __init__( def __init__(
self, self,
*args, *args,
width: int = None, width: Optional[int] = None,
rich_tracebacks: bool = True, rich_tracebacks: bool = True,
locals_max_depth: Optional[int] = None, locals_max_depth: Optional[int] = None,
tracebacks_max_frames: int = 100, tracebacks_max_frames: int = 100,

View File

@ -97,7 +97,7 @@ class Logger(logging.Logger):
datefmt=self.config.time_format, datefmt=self.config.time_format,
handlers=[handler, debug_handler, error_handler], handlers=[handler, debug_handler, error_handler],
) )
if config.capture_warnings: if self.config.capture_warnings:
logging.captureWarnings(True) logging.captureWarnings(True)
warnings_logger = logging.getLogger("py.warnings") warnings_logger = logging.getLogger("py.warnings")
warnings_logger.addHandler(handler) warnings_logger.addHandler(handler)