docs: update core and debug API docs
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
# Logger::Error
|
||||
|
||||
```cpp
|
||||
void Error(LogCategory category, const Containers::String& message)
|
||||
void Error(LogCategory category, const Containers::String& message);
|
||||
```
|
||||
|
||||
记录一条 Error(4 级)日志。Error 级别用于表示程序执行中发生的错误,如文件读取失败、网络连接中断等。程序通常可以继续运行但功能可能受限。
|
||||
记录 Error 级别日志。用于记录错误信息,表示发生了错误但程序可以继续运行。
|
||||
|
||||
**参数:**
|
||||
- `category` - 日志分类
|
||||
@@ -12,19 +12,21 @@ void Error(LogCategory category, const Containers::String& message)
|
||||
|
||||
**返回:** 无
|
||||
|
||||
**复杂度:** O(n),n 为注册的 Sink 数量
|
||||
**线程安全:** ✅
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Debug/Logger.h>
|
||||
#include "XCEngine/Debug/Logger.h"
|
||||
|
||||
XCEngine::Debug::Logger::Get().Error(
|
||||
XCEngine::Debug::LogCategory::Network,
|
||||
"Failed to connect to game server"
|
||||
);
|
||||
using namespace XCEngine::Debug;
|
||||
|
||||
Logger& logger = Logger::Get();
|
||||
logger.Error(LogCategory::Network, "Failed to connect to server");
|
||||
logger.Error(LogCategory::FileSystem, "Cannot open file");
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Logger 总览](logger.md) - 返回类总览
|
||||
- [Logger](logger.md) - 返回类总览
|
||||
- [LogLevel](../loglevel/loglevel.md) - 日志级别说明
|
||||
|
||||
Reference in New Issue
Block a user