fix(smtp): 给 LogClient 补 set_log_level 方法,修复启动崩溃

commit 9fc3542 把 set_log_level 加成模块级函数,但 smtp_v2.py:319
以 logs.set_log_level() 当实例方法调用,导致服务启动即抛
AttributeError: 'LogClient' object has no attribute 'set_log_level'。

新增 LogClient.set_log_level 委托给模块级函数,保持 logs 单例为
统一公开 API,模块级函数保留不破坏其他调用。
This commit is contained in:
qing committed 2026-08-10 12:26:59 +08:00
1 parent d17677bade
commit 01ae877673
1 file changed
+7
+7
View File
@@ -139,6 +139,13 @@ class LogClient:
def critical(self, service, message, **kw):
self.push(service, 'CRITICAL', message, **kw)
def set_log_level(self, level):
"""设置日志过滤阈值(低于该级别的日志将被丢弃)。
委托给模块级 set_log_level,统一通过 logs 单例对外暴露接口。
"""
set_log_level(level)
def flush(self):
"""手动 flush 队列中剩余的日志(含后台线程持有的局部 batch)。"""
self._flush_done.clear()