refactor(cleanup): 移除 logging 模块死代码
- unified_logger.py: 删除 5 个从未使用的装饰器/函数 - internal_loggers.py: 删除 3 个未使用方法和工厂函数 - action_logger.py: 删除 3 个未使用方法 - log_formatter.py: 删除 6 个未使用格式化函数(保留 GUI 依赖的 4 个) - 同步更新 __init__.py 和测试文件 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
703da834fb
commit
d19d5bfc56
8 files changed
+12
-482
No files matched your search
@@ -79,89 +79,6 @@ class TestFormatErrorLog:
|
||||
assert len(result) > 0
|
||||
|
||||
|
||||
class TestFormatCallStack:
|
||||
"""format_call_stack 纯函数测试。"""
|
||||
|
||||
def test_empty_stack(self):
|
||||
from douyin.logging.log_formatter import format_call_stack
|
||||
|
||||
result = format_call_stack(None)
|
||||
assert isinstance(result, str)
|
||||
|
||||
def test_with_stack(self):
|
||||
from douyin.logging.log_formatter import format_call_stack
|
||||
|
||||
stack = ["func1", "func2", "func3"]
|
||||
result = format_call_stack(stack)
|
||||
assert isinstance(result, str)
|
||||
|
||||
|
||||
class TestFormatParameters:
|
||||
"""format_parameters 纯函数测试。"""
|
||||
|
||||
def test_empty_params(self):
|
||||
from douyin.logging.log_formatter import format_parameters
|
||||
|
||||
result = format_parameters({})
|
||||
assert isinstance(result, str)
|
||||
|
||||
def test_with_params(self):
|
||||
from douyin.logging.log_formatter import format_parameters
|
||||
|
||||
result = format_parameters({"x": 1, "y": 2})
|
||||
assert isinstance(result, str)
|
||||
|
||||
|
||||
class TestFormatVariables:
|
||||
"""format_variables 纯函数测试。"""
|
||||
|
||||
def test_empty_vars(self):
|
||||
from douyin.logging.log_formatter import format_variables
|
||||
|
||||
result = format_variables({})
|
||||
assert isinstance(result, str)
|
||||
|
||||
def test_with_vars(self):
|
||||
from douyin.logging.log_formatter import format_variables
|
||||
|
||||
result = format_variables({"a": "hello", "b": 123})
|
||||
assert isinstance(result, str)
|
||||
|
||||
|
||||
class TestFormatException:
|
||||
"""format_exception 纯函数测试。"""
|
||||
|
||||
def test_value_error(self):
|
||||
from douyin.logging.log_formatter import format_exception
|
||||
|
||||
exc = ValueError("test error")
|
||||
result = format_exception(exc)
|
||||
assert "ValueError" in result or "test error" in result
|
||||
|
||||
def test_runtime_error(self):
|
||||
from douyin.logging.log_formatter import format_exception
|
||||
|
||||
exc = RuntimeError("runtime issue")
|
||||
result = format_exception(exc)
|
||||
assert isinstance(result, str)
|
||||
|
||||
|
||||
class TestAddSeparators:
|
||||
"""add_separators 纯函数测试。"""
|
||||
|
||||
def test_basic_text(self):
|
||||
from douyin.logging.log_formatter import add_separators
|
||||
|
||||
result = add_separators("test content")
|
||||
assert "test content" in result
|
||||
|
||||
def test_with_label(self):
|
||||
from douyin.logging.log_formatter import add_separators
|
||||
|
||||
result = add_separators("content", label="Section")
|
||||
assert "content" in result
|
||||
|
||||
|
||||
class TestAddColors:
|
||||
"""add_colors 纯函数测试。"""
|
||||
|
||||
|
||||
Reference in new issue
Block a user