7#include "libxr_def.hpp"
13static Topic log_topic;
17 log_topic = Topic::CreateTopic<LogData>(
"/xr/log",
nullptr,
false,
true);
19#if LIBXR_PRINTF_BUFFER_SIZE > 0
static Callback Create(FunType fun, ArgType arg)
创建一个新的回调对象,并绑定回调函数和参数。 Creates a new callback instance, binding a function and an argument.
static void Init()
初始化日志主题 / Initialize the log topic
static void Publish(LogLevel level, const char *file, uint32_t line, const char *fmt,...)
发布一条日志 / Publish a log message
static void PrintToTerminal(const LogData &data)
打印日志到终端 / Print log to terminal
原始数据封装类。 A class for encapsulating raw data.
static WritePort * write_
Write port instance. 写入端口。
static uint32_t GetTime()
获取当前系统时间(毫秒) Gets the current system time in milliseconds
表示毫秒级时间戳的类。Class representing a timestamp in milliseconds.
主题(Topic)管理类 / Topic management class
void Publish(Data &data)
发布数据 Publishes data
void RegisterCallback(Callback< RawData & > &cb)
注册回调函数 Registers a callback function
bool Writable()
判断端口是否可写。 Checks whether the port is writable.
LibXR Color Control Library / LibXR终端颜色控制库
constexpr auto min(T1 a, T2 b) -> typename std::common_type< T1, T2 >::type
计算两个数的最小值
LogLevel
日志级别枚举 / Log level enumeration
日志数据结构体 / Log data structure
uint32_t line
行号 / Line number
const char * file
文件名指针 / Source file name pointer
LogLevel level
日志级别 / Log level
TimestampMS timestamp
时间戳 / Timestamp
char message[XR_LOG_MESSAGE_MAX_LEN]
日志消息内容 / Log message content