6#include "libxr_color.hpp"
8#include "libxr_time.hpp"
72 static void Publish(
LogLevel level,
const char* file, uint32_t line, Args&&... args)
74 constexpr auto frontend =
89 static void Publish(
LogLevel level,
const char* file, uint32_t line, Args&&... args)
92 "LibXR::Logger: explicit literal tag must be XR_FMT(...) or XR_PRINTF(...)");
94 constexpr auto frontend =
135 auto written = Print::FormatIntoBuffer(data.
message,
sizeof(data.
message), format,
136 std::forward<Args>(args)...);
142 auto written = Print::FormatIntoBuffer(data.
message,
sizeof(data.
message), format,
143 std::forward<Args>(args)...);
日志管理器 / LibXR Logger Manager
static void PublishSelected(LogLevel level, const char *file, uint32_t line, Args &&... args)
按已确定前端发布一条日志 Publish one log entry under the already selected frontend
static void PublishToTopic(LogData &data)
把一条日志数据发布到内部日志 topic Publish one log record into the internal log topic
static void Init()
初始化日志主题 / Initialize the log topic
static void Publish(LogLevel level, const char *file, uint32_t line, Args &&... args)
发布一条字面量日志 / Publish one literal log message
static bool initialized_
是否已经完成日志 topic 初始化 / Whether logger-topic initialization has completed.
static void Publish(LogLevel level, const char *file, uint32_t line, Args &&... args)
发布一条带显式前端标签的字面量日志 / Publish one literal log message with an explicit frontend tag
static consteval Compiled< Source > Build()
在编译期解析并校验 printf 格式串 / Parse and validate a printf format at compile time
consteval Frontend SelectFrontend()
Selects the final logger frontend after validating the resolution result.
Frontend
Logger literal frontend selection mode.
@ Auto
select brace or printf automatically / 自动选择 brace 或 printf
@ Format
force brace-style frontend / 强制使用 brace 风格前端
LogLevel
日志级别枚举 / Log level enumeration
@ XR_LOG_LEVEL_INFO
一般信息 / Informational message
@ XR_LOG_LEVEL_DEBUG
调试信息 / Debug message
@ XR_LOG_LEVEL_WARN
警告信息 / Warning message
@ XR_LOG_LEVEL_ERROR
错误信息 / Error message
@ XR_LOG_LEVEL_PASS
通过信息 / Pass message
日志数据结构体 / Log data structure
uint32_t line
行号 / Line number
const char * file
文件名指针 / Source file name pointer
LogLevel level
日志级别 / Log level
char message[XR_LOG_MESSAGE_MAX_LEN]
日志消息内容 / Log message content
作为 printf 格式源的结构化字符串字面量包装 / Structural literal wrapper used as the NTTP source for printf formats