sync lib not dr

This commit is contained in:
shenjack 2023-11-05 23:57:13 +08:00
parent c7140e0ef2
commit 8eabaa8d9c
Signed by: shenjack
GPG Key ID: 7B1134A979775551
3 changed files with 7 additions and 6 deletions

View File

@ -20,7 +20,7 @@ class Logger(Options):
outputs: List[BaseOutputStream] = [] outputs: List[BaseOutputStream] = []
enable: bool = True enable: bool = True
level: int = 20 level: int = 20 # info
def log_for(self, level: int) -> bool: def log_for(self, level: int) -> bool:
""" """

View File

@ -28,7 +28,7 @@ __all__ = [
class BaseOutputStream(Options): class BaseOutputStream(Options):
name = 'BaseOutputStream' name = 'BaseOutputStream'
level: int = 10 level: int = 20
enable: bool = True enable: bool = True
formatter: BaseFormatter formatter: BaseFormatter
@ -49,7 +49,7 @@ class BaseOutputStream(Options):
class StdioOutputStream(BaseOutputStream): class StdioOutputStream(BaseOutputStream):
name = 'StdioOutputStream' name = 'StdioOutputStream'
level: int = 10 level: int = 20
formatter: BaseFormatter = StdFormatter() formatter: BaseFormatter = StdFormatter()
def write_stdout(self, message: LogMessage) -> None: def write_stdout(self, message: LogMessage) -> None:
@ -81,7 +81,7 @@ class StdioOutputStream(BaseOutputStream):
class FileCacheOutputStream(BaseOutputStream): class FileCacheOutputStream(BaseOutputStream):
name = 'FileCacheOutputStream' name = 'FileCacheOutputStream'
level: int = 10 level: int = 20
formatter: BaseFormatter = StdFormatter(enable_color=False) formatter: BaseFormatter = StdFormatter(enable_color=False)
text_cache: io.StringIO = None text_cache: io.StringIO = None

View File

@ -6,8 +6,9 @@
import time import time
from pathlib import Path
from types import FrameType from types import FrameType
from typing import List, Optional, Tuple, Dict from typing import List, Optional, Tuple, Dict, Union
from lib_not_dr.types.options import Options from lib_not_dr.types.options import Options
@ -92,7 +93,7 @@ class LogMessage(Options):
return int(self.log_time / 1000000) % 1000 return int(self.log_time / 1000000) % 1000
FormattingMessage = Tuple[LogMessage, Dict[str, str]] FormattingMessage = Tuple[LogMessage, Dict[str, Union[str, Path]]]
if __name__ == '__main__': if __name__ == '__main__':
print(LogMessage().as_markdown()) print(LogMessage().as_markdown())