![]() |
ShitEngine 1.4.2
基于 C++20 与 SDL3 的轻量级 2D 游戏引擎
|
日志封装类 更多...
#include <Log.h>
Public 类型 | |
| using | MessageCallback = std::function<void(bool isCore, int level, const std::string& message)> |
| 日志消息回调:isCore = 引擎日志(Shit)/ 用户日志(App);level = spdlog 等级;message = 文本 | |
静态 Public 成员函数 | |
| static bool | Init () |
| template<typename... Args> | |
| static void | Trace (fmt::format_string< Args... > fmt, Args &&... args) |
| template<typename... Args> | |
| static void | Debug (fmt::format_string< Args... > fmt, Args &&... args) |
| template<typename... Args> | |
| static void | Info (fmt::format_string< Args... > fmt, Args &&... args) |
| template<typename... Args> | |
| static void | Warn (fmt::format_string< Args... > fmt, Args &&... args) |
| template<typename... Args> | |
| static void | Error (fmt::format_string< Args... > fmt, Args &&... args) |
| template<typename... Args> | |
| static void | Critical (fmt::format_string< Args... > fmt, Args &&... args) |
| static std::shared_ptr< spdlog::logger > & | GetCoreLogger () |
| static std::shared_ptr< spdlog::logger > & | GetClientLogger () |
| static void | SetMessageCallback (MessageCallback cb) |
| 注册全局日志转发回调(Init 前/后均可;重新注册替换旧回调;传 nullptr 解除转发) | |
| static const MessageCallback & | GetMessageCallback () |
| 当前回调(供引擎内部 sink 读取) | |
| static void | SetLogDirectory (const std::string &dir) |
| 设置文件日志目录(P32:编辑器打开项目后把日志写入项目 .shitengine/log) dir 为最终日志目录(引擎内部不再拼接子目录);空 = 恢复默认(进程工作目录/.shitengine/log)。 未初始化时仅记录,Init() 按新目录创建;已初始化时重建文件 sink(旧文件关闭、 新目录按当前时间新开归档文件)。幂等,可重复调用。 | |
日志封装类
| using MessageCallback = std::function<void(bool isCore, int level, const std::string& message)> |
日志消息回调:isCore = 引擎日志(Shit)/ 用户日志(App);level = spdlog 等级;message = 文本
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
当前回调(供引擎内部 sink 读取)
|
inlinestatic |
|
static |
|
static |
设置文件日志目录(P32:编辑器打开项目后把日志写入项目 .shitengine/log) dir 为最终日志目录(引擎内部不再拼接子目录);空 = 恢复默认(进程工作目录/.shitengine/log)。 未初始化时仅记录,Init() 按新目录创建;已初始化时重建文件 sink(旧文件关闭、 新目录按当前时间新开归档文件)。幂等,可重复调用。
|
static |
注册全局日志转发回调(Init 前/后均可;重新注册替换旧回调;传 nullptr 解除转发)
|
inlinestatic |
|
inlinestatic |