feat: add logger to docs
This commit is contained in:
parent
5628010e84
commit
7fc18c6dc9
@ -6,7 +6,7 @@ A python lib came from [Difficult Rocket](https://github.com/shenjackyuanjie/Dif
|
|||||||
|
|
||||||
## Information/信息
|
## Information/信息
|
||||||
|
|
||||||
- Version / 版本: 0.1.8
|
- Version / 版本: 0.2.0-alpha0
|
||||||
- Author / 作者: shenjackyuanjie 3695888@qq.com
|
- Author / 作者: shenjackyuanjie 3695888@qq.com
|
||||||
|
|
||||||
> [shenjackyuanjie](https://github/shenjackyuanjie)
|
> [shenjackyuanjie](https://github/shenjackyuanjie)
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
# Change log / 更新日志
|
# Change log / 更新日志
|
||||||
|
|
||||||
|
## 0.2.0-alpha0
|
||||||
|
|
||||||
|
### Logger
|
||||||
|
|
||||||
|
- 添加了 Logger (虽说 0.1.8 就有了)
|
||||||
|
- 目前入口点位于 `lib_not_dr.logger.logger.Logger`
|
||||||
|
|
||||||
## 0.1.8
|
## 0.1.8
|
||||||
|
|
||||||
- 为 `types.Options` 添加了 `_check_option` 选项
|
- 为 `types.Options` 添加了 `_check_option` 选项
|
||||||
|
@ -4,4 +4,4 @@
|
|||||||
# All rights reserved
|
# All rights reserved
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
|
|
||||||
__version__ = '0.1.8'
|
__version__ = '0.2.0-alpha0'
|
||||||
|
@ -16,6 +16,12 @@ from lib_not_dr.logger.structure import LogMessage, FormattingMessage
|
|||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from lib_not_dr.logger.formatter.colors import BaseColorFormatter
|
from lib_not_dr.logger.formatter.colors import BaseColorFormatter
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
'BaseFormatter',
|
||||||
|
'MainFormatter',
|
||||||
|
'StdFormatter'
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class BaseFormatter(Options):
|
class BaseFormatter(Options):
|
||||||
name = 'BaseFormatter'
|
name = 'BaseFormatter'
|
||||||
@ -189,7 +195,7 @@ class StdFormatter(BaseFormatter):
|
|||||||
|
|
||||||
enable_color: bool = True
|
enable_color: bool = True
|
||||||
|
|
||||||
sub_formatter: List[BaseFormatter] = [MainFormatter()]
|
sub_formatter: List[BaseFormatter] = []
|
||||||
from lib_not_dr.logger.formatter.colors import (LevelColorFormatter,
|
from lib_not_dr.logger.formatter.colors import (LevelColorFormatter,
|
||||||
LoggerColorFormatter,
|
LoggerColorFormatter,
|
||||||
TimeColorFormatter,
|
TimeColorFormatter,
|
||||||
@ -204,6 +210,7 @@ class StdFormatter(BaseFormatter):
|
|||||||
def __init__(self,
|
def __init__(self,
|
||||||
enable_color: bool = True,
|
enable_color: bool = True,
|
||||||
sub_formatter: Optional[List[BaseFormatter]] = None,
|
sub_formatter: Optional[List[BaseFormatter]] = None,
|
||||||
|
main_formatter: Optional[MainFormatter] = None,
|
||||||
color_formatters: Optional[List[BaseFormatter]] = None,
|
color_formatters: Optional[List[BaseFormatter]] = None,
|
||||||
**kwargs) -> None:
|
**kwargs) -> None:
|
||||||
"""
|
"""
|
||||||
@ -219,6 +226,10 @@ class StdFormatter(BaseFormatter):
|
|||||||
self.sub_formatter = sub_formatter
|
self.sub_formatter = sub_formatter
|
||||||
if color_formatters is not None:
|
if color_formatters is not None:
|
||||||
self.color_formatters = color_formatters
|
self.color_formatters = color_formatters
|
||||||
|
if main_formatter is not None and isinstance(main_formatter, MainFormatter):
|
||||||
|
self.main_formatter = main_formatter
|
||||||
|
else:
|
||||||
|
self.main_formatter = MainFormatter()
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
def _format(self, message: FormattingMessage) -> FormattingMessage:
|
def _format(self, message: FormattingMessage) -> FormattingMessage:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[project]
|
[project]
|
||||||
version = "0.1.8"
|
version = "0.2.0-alpha0"
|
||||||
name = "lib-not-dr"
|
name = "lib-not-dr"
|
||||||
description = "A python lib created from Difficult Rocket development"
|
description = "A python lib created from Difficult Rocket development"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
Loading…
Reference in New Issue
Block a user