#0005 增加日志

This commit is contained in:
zhengxuan.zhang
2026-03-13 16:59:31 +08:00
parent 75cb502d0d
commit 029752e231
18 changed files with 997 additions and 105 deletions
+105 -16
View File
@@ -1,20 +1,109 @@
#简介
TODO: 简要介绍你的项目。通过此节说明此项目的目标或动机。
## XplorePlane 平面CT软件
#入门
TODO: 指导用户在自己的系统上设置和运行代码。在本节中,可讨论:
1. 安装过程
2. 软件依赖项
3. 最新发布
4. API 参考
### 系统目标
#生成与测试
TODO: 说明并展示如何生成代码和运行测试。
XplorePlane 系统用于控制平面 CT 设备的各个子系统(射线源、探测器、运动控制)并完成采集图像的处理与分析,为研发与调试提供统一的软件平台。
#参与
TODO: 说明其他用户和开发人员可如何帮助改善代码。
**总体架构风格**
如需深入了解如何创建优秀的自述文件,请参阅以下[指南](https://docs.microsoft.com/en-us/azure/devops/repos/git/create-a-readme?view=azure-devops)。还可从以下自述文件中寻求灵感:
- [ASP.NET Core](https://github.com/aspnet/Home)
- [Visual Studio Code](https://github.com/Microsoft/vscode)
- [Chakra Core](https://github.com/Microsoft/ChakraCore)
- 客户端框架: WPF + Prism MVVM(项目 XplorePlane,目标框架 net8.0-windows
- 图像处理内核: 独立类库 ImageProcessing.Core(算子基类与参数模型)和 ImageProcessing.Processors(具体算子实现),基于 EmguCV
- 基础设施: 日志使用 Serilog,序列化使用 Newtonsoft.Json,资源统一通过 WPF 资源系统管理
**开发目标**
在现有图像处理与 UI 基础上,引入并集成:
- 射线源子系统(X-Ray Source
- 探测器子系统(Detector
- 运动控制子系统(Motion Control
- 通过统一的 CT 扫描工作流,在 UI 中实现一键式扫描、实时状态监控与图像后处理
### 项目框架
```css
XplorePlane/
├── XplorePlane.csproj # .NET 8 WPF project file
├── App.xaml # Application + global ResourceDictionary
├── App.xaml.cs
├── Views/
│ └── MainWindow.xaml # Main window (Grid + StackPanel layout)
│ └── MainWindow.xaml.cs # Code-behind (minimal only TreeView event)
├── ViewModels/
│ └── MainViewModel.cs # Root VM: navigation, callouts, props, commands
│ └── NavGroupNode.cs # Tree group node VM
│ └── NavLeafNode.cs # Tree leaf node VM
│ └── InspectionCalloutVM.cs # Overlay callout card VM
│ └── CalloutRowVM.cs # Single callout data row VM
│ └── RelayCommand.cs # ICommand implementation
├── Models/
│ └── FeatureProperties.cs # Bindable domain model for right panel
└── Assets/
└── Icons/ # 28×28 toolbar icon PNGs
```
### XplorePlane.Hardware(硬件库)
### XplorePlane.ImageProcessing (图像库)
### 日志系统
项目已集成 Serilog 日志框架,提供统一的日志服务:
- **日志框架**: Serilog 4.3.1
- **日志输出**: 控制台、文件(按天滚动)、调试输出
- **日志路径**: `logs/xploreplane-YYYYMMDD.log`
- **配置文件**: `App.config`
- **服务接口**: `ILoggerService`
**使用示例**:
```csharp
public class MyService
{
private readonly ILoggerService _logger;
public MyService(ILoggerService logger)
{
// 使用泛型自动推断模块名
_logger = logger?.ForModule<MyService>() ?? throw new ArgumentNullException(nameof(logger));
}
public void DoSomething()
{
_logger.Info("执行操作");
_logger.Debug("调试信息:参数={Value}", someValue);
}
}
```
详细使用指南请参考:`Doc/Logging.README.md`
### TO-DO List
- [x] 软件基于 WPF + Prism 基础的框架
- [x] 日志库的引用
- [ ] 界面的布局
- [ ] 打通与硬件层的调用流程
- [ ] 打通与图像层的调用流程