#middleware #real-time #copper #debugging #log-file

cu29-log-derive

这是Copper文本日志宏的一部分。它不能独立于copper项目使用。

2个版本

0.2.2 2024年8月12日
0.2.1 2024年7月29日

#17 in #copper

Download history 135/week @ 2024-07-28 5/week @ 2024-08-04 153/week @ 2024-08-11

293 每月下载量
7 个crate中使用 (4个直接使用)

Apache-2.0

19KB
300

结构化日志宏

cu29_log_derive crate提供了如!debug这样的宏,以启用结构化日志,允许您以二进制格式高效地记录数据。

示例用法

debug!("This string won't be stored nor interpreted on the robot", myvaluename = 42);

而不是将完整的格式化字符串存储在日志文件中,此宏捕获格式字符串和参数名称的唯一标识符,然后以紧凑的bincode格式记录值。这种方法显著提高了日志效率。

Copper集成

如果您将此crate作为Copper项目的一部分使用,则不需要额外的设置。日志将自动与统一日志记录器(cu29_unifiedlog)集成,以二进制格式存储日志。

独立使用

对于独立于Copper使用此crate的用户,请按照cu_standalone_structlog中提供的示例设置配置您的日志记录器。

提取日志

您可以使用Rust或Python提取和查看您的日志。

依赖项

~4–7MB
~156K SLoC