Fix | 没加进去的参数

This commit is contained in:
shenjack 2023-11-29 00:16:04 +08:00
parent 8a61010877
commit 976da68d24
Signed by: shenjack
GPG Key ID: 7B1134A979775551

View File

@ -39,8 +39,7 @@ class LogMessage:
log_time: Optional[float] = None, log_time: Optional[float] = None,
logger_name: Optional[str] = 'root', logger_name: Optional[str] = 'root',
logger_tag: Optional[str] = None, logger_tag: Optional[str] = None,
stack_trace: Optional[FrameType] = None, stack_trace: Optional[FrameType] = None) -> None:
**kwargs) -> None:
""" """
Init for LogMessage Init for LogMessage
:param messages: message list for log :param messages: message list for log
@ -52,7 +51,6 @@ class LogMessage:
:param logger_name: name of logger :param logger_name: name of logger
:param logger_tag: tag of logger :param logger_tag: tag of logger
:param stack_trace: stack trace of logger :param stack_trace: stack trace of logger
:param kwargs: other options
""" """
# 20231128 23:23 # 20231128 23:23
# 因为 Options 的初始化太慢了 所以改为不继承 直接编写 # 因为 Options 的初始化太慢了 所以改为不继承 直接编写
@ -63,7 +61,7 @@ class LogMessage:
self.level = level self.level = level
self.logger_name = logger_name self.logger_name = logger_name
self.logger_tag = logger_tag self.logger_tag = logger_tag
self.stack_trace = stack_trace
if log_time is None: if log_time is None:
log_time = time.time_ns() log_time = time.time_ns()
@ -73,6 +71,18 @@ class LogMessage:
flush = True if flush else False flush = True if flush else False
self.flush = flush self.flush = flush
def option(self) -> Dict[str, Union[str, int, float, bool]]:
return {
'messages': self.messages,
'end': self.end,
'split': self.split,
'flush': self.flush,
'level': self.level,
'log_time': self.log_time,
'logger_name': self.logger_name,
'logger_tag': self.logger_tag,
'stack_trace': self.stack_trace,
}
def format_message(self) -> str: def format_message(self) -> str:
if self.split is None: if self.split is None: