添加默认logger

This commit is contained in:
xunbu
2025-09-09 17:32:08 +08:00
parent 787009dcaa
commit e82f6f1d15
4 changed files with 88 additions and 84 deletions

View File

@@ -12,7 +12,7 @@ from docutranslate.logger import global_logger
@dataclass(kw_only=True)
class ConverterConfig(ABC):
logger: Logger | None = None
logger: Logger = global_logger
@abstractmethod
def gethash(self) -> Hashable:
@@ -23,13 +23,11 @@ class Converter(ABC):
def __init__(self, config: ConverterConfig | None = None):
self.config = config
if config:
self.logger = config.logger or global_logger
else:
self.logger = global_logger
self.logger = config.logger
@abstractmethod
def convert(self, document: Document) -> Document:
...
async def convert_async(self, document: Document) -> Document:
...
...