fix: improve doc link navigation and tree display
- Fix link resolution with proper relative/absolute path handling - Improve link styling with underline decoration - Hide leaf nodes from tree, only show directories - Fix log file path for packaged app
This commit is contained in:
24
docs/api/debug/filelogsink/construct.md
Normal file
24
docs/api/debug/filelogsink/construct.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# FileLogSink::FileLogSink
|
||||
|
||||
```cpp
|
||||
FileLogSink(const Containers::String& filePath)
|
||||
```
|
||||
|
||||
构造函数,打开指定路径的文件用于日志写入。如果文件已存在,则追加写入;如果不存在,则创建新文件。
|
||||
|
||||
**参数:**
|
||||
- `filePath` - 日志文件路径
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
auto fileSink = std::make_unique<XCEngine::Debug::FileLogSink>("logs/engine.log");
|
||||
XCEngine::Debug::Logger::Get().AddSink(std::move(fileSink));
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [FileLogSink 总览](filelogsink.md) - 返回类总览
|
||||
- [Debug 模块总览](../debug.md) - 返回模块总览
|
||||
37
docs/api/debug/filelogsink/filelogsink.md
Normal file
37
docs/api/debug/filelogsink/filelogsink.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# FileLogSink
|
||||
|
||||
**命名空间**: `XCEngine::Debug`
|
||||
|
||||
**类型**: `class`
|
||||
|
||||
**头文件**: `XCEngine/Debug/FileLogSink.h`
|
||||
|
||||
**描述**: 文件日志输出目标,将日志写入到指定文件。
|
||||
|
||||
## 概述
|
||||
|
||||
`FileLogSink` 是日志系统的文件输出实现。它将日志条目写入到指定的文件,支持追加写入模式。
|
||||
|
||||
## 公共方法
|
||||
|
||||
| 方法 | 描述 |
|
||||
|------|------|
|
||||
| `FileLogSink(const Containers::String& filePath)` | [构造函数](construct.md) |
|
||||
| `~FileLogSink()` | [析构函数](~filelogsink.md) |
|
||||
| `void Log(const LogEntry& entry)` | [输出日志到文件](log.md) |
|
||||
| `void Flush()` | [刷新缓冲区](flush.md) |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Debug/FileLogSink.h>
|
||||
|
||||
auto fileSink = std::make_unique<XCEngine::Debug::FileLogSink>("logs/app.log");
|
||||
XCEngine::Debug::Logger::Get().AddSink(std::move(fileSink));
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Debug 模块总览](../debug.md) - 返回模块总览
|
||||
- [Logger](../logger/logger.md) - 日志记录器
|
||||
- [ILogSink](../ilogsink/ilogsink.md) - 日志输出接口
|
||||
24
docs/api/debug/filelogsink/flush.md
Normal file
24
docs/api/debug/filelogsink/flush.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# FileLogSink::Flush
|
||||
|
||||
```cpp
|
||||
void Flush() override
|
||||
```
|
||||
|
||||
刷新文件缓冲区,调用底层 `FileWriter` 的 flush 方法确保所有待写入的日志数据已实际写入磁盘。
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
auto fileSink = std::make_unique<XCEngine::Debug::FileLogSink>("logs/app.log");
|
||||
XCEngine::Debug::Logger::Get().AddSink(std::move(fileSink));
|
||||
// 关键操作后立即刷新
|
||||
XCEngine::Debug::Logger::Get().Info(XCEngine::Debug::LogCategory::General, "Checkpoint saved");
|
||||
// 确保写入磁盘
|
||||
XCEngine::Debug::Logger::Get().Flush();
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [FileLogSink 总览](filelogsink.md) - 返回类总览
|
||||
25
docs/api/debug/filelogsink/log.md
Normal file
25
docs/api/debug/filelogsink/log.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# FileLogSink::Log
|
||||
|
||||
```cpp
|
||||
void Log(const LogEntry& entry) override
|
||||
```
|
||||
|
||||
将日志条目追加写入文件。根据 `LogEntry` 的各字段格式化日志行,包括时间戳、级别、分类、消息,并追加到文件末尾。
|
||||
|
||||
**参数:**
|
||||
- `entry` - 日志条目
|
||||
|
||||
**复杂度:** O(m),m 为消息长度
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
auto fileSink = std::make_unique<XCEngine::Debug::FileLogSink>("logs/app.log");
|
||||
XCEngine::Debug::Logger::Get().AddSink(std::move(fileSink));
|
||||
// Log 方法由 Logger 在内部调用
|
||||
XCEngine::Debug::Logger::Get().Error(XCEngine::Debug::LogCategory::FileSystem, "File not found");
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [FileLogSink 总览](filelogsink.md) - 返回类总览
|
||||
13
docs/api/debug/filelogsink/~filelogsink.md
Normal file
13
docs/api/debug/filelogsink/~filelogsink.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# FileLogSink::~FileLogSink
|
||||
|
||||
```cpp
|
||||
~FileLogSink() override
|
||||
```
|
||||
|
||||
析构函数。销毁 `FileLogSink` 实例,调用 `Flush()` 确保所有日志数据写入文件,然后关闭文件句柄。
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [FileLogSink 总览](filelogsink.md) - 返回类总览
|
||||
Reference in New Issue
Block a user