Difficult-Rocket/libs/utils/logger/structers.py

40 lines
915 B
Python

# -------------------------------
# Difficult Rocket
# Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com
# All rights reserved
# -------------------------------
import time
from types import FrameType
from typing import List, Optional
from lib_not_dr.types.options import Options
class LogMessage(Options):
name = 'LogMessage'
# 消息内容本身的属性
messages: List[str] = []
end: str = '\n'
split: str = ' '
# 消息的属性
flush: bool = True
level: int = 20
log_time: float = None # time.time_ns()
logger_name: str = 'root'
logger_tag: Optional[str] = None
stack_trace: Optional[FrameType] = None
def init(self, **kwargs) -> bool:
if self.log_time is None:
self.log_time = time.time_ns()
return False
@property
def create_msec_3(self) -> int:
return int(self.log_time / 1000000) % 1000