- Removed the `.coverage` file from the repository to streamline coverage management. - Updated `.gitignore` to exclude coverage-related files and directories, ensuring a cleaner project structure. - Introduced new scripts for checking GPU availability and detecting GUI parameter conflicts, enhancing the overall functionality of the application. - Improved logging mechanisms across various modules to support better debugging and monitoring. - Added comprehensive documentation for new features and updated existing markdown files for clarity.
51 lines
1.4 KiB
Python
51 lines
1.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""调试日志写入问题"""
|
|
import douyin_logging
|
|
douyin_logging.configure_logging()
|
|
|
|
import logging
|
|
root = logging.getLogger()
|
|
print(f"Root logger handlers: {len(root.handlers)}")
|
|
for i, h in enumerate(root.handlers):
|
|
print(f" Handler {i+1}: {type(h).__name__}, level: {h.level}")
|
|
|
|
print(f"Root logger level: {root.level}")
|
|
print(f"Root logger effective level: {root.getEffectiveLevel()}")
|
|
|
|
# 测试直接写入根 logger
|
|
root.info("直接写入根 logger 的测试日志")
|
|
import time
|
|
time.sleep(0.5)
|
|
|
|
# 测试 fudai_analyse
|
|
from douyin_fudai import fudai_analyse
|
|
a = fudai_analyse()
|
|
|
|
# 检查 _std_logger
|
|
if hasattr(a, '_std_logger') and a._std_logger is not None:
|
|
print(f"_std_logger: {a._std_logger}")
|
|
print(f"_std_logger handlers: {len(a._std_logger.handlers)}")
|
|
print(f"_std_logger propagate: {a._std_logger.propagate}")
|
|
|
|
# 写入日志
|
|
a._log_kv("调试", "这是调试日志", debug_field="debug_value")
|
|
time.sleep(0.5)
|
|
|
|
# 检查日志文件
|
|
from datetime import datetime
|
|
today = datetime.now().strftime("%Y-%m-%d")
|
|
log_file = f"logs/unified_{today}.log"
|
|
|
|
import os
|
|
if os.path.exists(log_file):
|
|
with open(log_file, 'r', encoding='utf-8') as f:
|
|
lines = f.readlines()
|
|
print(f"\nLog file lines: {len(lines)}")
|
|
print("Last 5 lines:")
|
|
for line in lines[-5:]:
|
|
print(f" {line.rstrip()}")
|
|
|
|
|
|
|
|
|