Closed HeartfeltJoy closed 1 week ago
此拉取请求通过移除 Loguru 模块并实现自定义日志记录器来重构日志系统。更改包括创建一个新的日志记录模块,具有更好的结构化日志记录功能,并添加一个 CONTRIBUTING.md 文件以建立项目标准。该实现的重点是使日志系统更易于维护和一致,同时减少外部依赖。
classDiagram
class Logger {
-log_buffer: list[Log]
-log_buffer_size: int
-log_buffer_delete_size: int
+__init__()
+load_config()
+createLogFile()
+clearBuffer()
+debug(message: str, log_type: LogType, log_source: LogSource, log_position: LogPosition, log_group: LogGroup)
+info(message: str, log_type: LogType, log_source: LogSource, log_position: LogPosition, log_group: LogGroup)
+warning(message: str, log_type: LogType, log_source: LogSource, log_position: LogPosition, log_group: LogGroup)
+error(message: str, log_type: LogType, log_source: LogSource, log_position: LogPosition, log_group: LogGroup)
+group(name: str, log_type: LogType, log_source: LogSource)
}
class Log {
+level: LogLevel
+message: str
+time: int | float
+log_type: LogType
+source: LogSource
+position: LogPosition
+toString()
}
class LogGroup {
+name: str
+log_type: LogType
+log_source: LogSource
+add(log: Log)
+toString()
}
class LogPosition {
+module: str
+file: str
+line: int
}
class LogLevel {
<<enumeration>>
DBUG
INFO
WARN
EROR
CRIT
ALL_
}
class LogType {
<<enumeration>>
FILE_FUNC
NETWORK
NONE_TYPE
}
class LogSource {
<<enumeration>>
UI
CORE
NONE
}
Logger --> Log
Logger --> LogGroup
Log --> LogPosition
LogLevel --> Log
LogType --> Log
LogSource --> Log
classDiagram
class PathFunc {
+qq_path: Path
+base_path: Path
+napcat_path: Path
+config_dir_path: Path
+tmp_path: Path
+config_path: Path
+bot_config_path: Path
+path_validator()
+get_qq_path() Path | None
}
更改 | 详情 | 文件 |
---|---|---|
实现了自定义日志系统以替换 Loguru |
|
src/Core/Utils/logger/log_func.py src/Core/Utils/logger/log_data.py src/Core/Utils/logger/log_enum.py src/Core/Utils/logger/log_utils.py src/Core/Utils/logger/__init__.py |
重构了整个应用程序的日志调用 |
|
src/Core/NetworkFunc/Downloader.py src/Core/Utils/PathFunc.py src/Core/Utils/GetVersion.py src/Core/Utils/InstallFunc.py src/Ui/MainWindow/Window.py src/Ui/MainWindow/TitleBar.py main.py |
添加了项目贡献指南 |
|
.github/CONTRIBUTING.md |
从设置页面移除了日志查看功能 |
|
src/Ui/SetupPage/Setup.py |
@sourcery-ai review
@sourcery-ai review
Issues
10 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.5% Duplication on New Code
@sourcery-ai summary
I'm sorry, I don't understand the command @sourcery-ai summary
.
Please use @sourcery-ai review
to request a review.
@sourcery-ai
@sourcery-ai review
Summary by Sourcery
通过移除 Loguru 模块并实现自定义记录器来重构日志系统。添加 CONTRIBUTING.md 文件以指导贡献者遵循项目标准。
增强功能:
文档:
Original summary in English
## Summary by Sourcery Refactor the logging system by removing the Loguru module and implementing a custom logger. Add a CONTRIBUTING.md file to guide contributors on project standards. Enhancements: - Refactor the logging system by removing the Loguru module and implementing a custom logger. Documentation: - Add a CONTRIBUTING.md file to guide contributors on naming conventions, file structure, code formatting, documentation, and version control.增强功能:
文档:
Original summary in English
## Summary by Sourcery 通过移除 Loguru 模块并实现自定义记录器来重构日志系统。添加 CONTRIBUTING.md 文件以指导贡献者遵循项目标准。 增强功能: - 通过移除 Loguru 模块并实现自定义记录器来重构日志系统。 文档: - 添加 CONTRIBUTING.md 文件以指导贡献者关于命名约定、文件结构、代码格式、文档和版本控制。Original summary in English
## Summary by Sourcery Refactor the logging system by removing the Loguru module and implementing a custom logger. Add a CONTRIBUTING.md file to guide contributors on project standards. Enhancements: - Refactor the logging system by removing the Loguru module and implementing a custom logger. Documentation: - Add a CONTRIBUTING.md file to guide contributors on naming conventions, file structure, code formatting, documentation, and version control.增强功能:
文档:
Original summary in English
## Summary by Sourcery 通过移除 Loguru 模块并实现自定义记录器来重构日志系统。添加 CONTRIBUTING.md 文件以指导贡献者遵循项目标准。 增强功能: - 通过移除 Loguru 模块并实现自定义记录器来重构日志系统。 文档: - 添加 CONTRIBUTING.md 文件以指导贡献者关于命名约定、文件结构、代码格式、文档和版本控制。Original summary in English
## Summary by Sourcery Refactor the logging system by removing the Loguru module and implementing a custom logger. Add a CONTRIBUTING.md file to guide contributors on project standards. Enhancements: - Refactor the logging system by removing the Loguru module and implementing a custom logger. Documentation: - Add a CONTRIBUTING.md file to guide contributors on naming conventions, file structure, code formatting, documentation, and version control.Original summary in English
## Summary by Sourcery 通过移除 Loguru 模块并实现自定义记录器来重构日志系统。添加 CONTRIBUTING.md 文件以指导贡献者遵循项目标准。 增强功能: - 通过移除 Loguru 模块并实现自定义记录器来重构日志系统。 文档: - 添加 CONTRIBUTING.md 文件以指导贡献者关于命名约定、文件结构、代码格式、文档和版本控制。Original summary in English
## Summary by Sourcery Refactor the logging system by removing the Loguru module and implementing a custom logger. Add a CONTRIBUTING.md file to guide contributors on project standards. Enhancements: - Refactor the logging system by removing the Loguru module and implementing a custom logger. Documentation: - Add a CONTRIBUTING.md file to guide contributors on naming conventions, file structure, code formatting, documentation, and version control.Summary by Sourcery
通过移除 Loguru 模块并实现自定义记录器来重构日志系统。添加 CONTRIBUTING.md 文件以指导贡献者遵循项目标准。
增强功能:
文档:
Original summary in English
## Summary by Sourcery Refactor the logging system by removing the Loguru module and implementing a custom logger. Add a CONTRIBUTING.md file to guide contributors on project standards. Enhancements: - Refactor the logging system by removing the Loguru module and implementing a custom logger. Documentation: - Add a CONTRIBUTING.md file to guide contributors on naming conventions, file structure, code formatting, documentation, and version control.