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

macro cu29-log-derive

This is part of the text logging macros Copper. It cannot be used independently from the copper project.

9 unstable releases (3 breaking)

0.5.1 Dec 5, 2024
0.4.1 Nov 15, 2024
0.2.1 Jul 29, 2024

#33 in #copper

Download history 8/week @ 2024-09-02 116/week @ 2024-09-09 38/week @ 2024-09-16 51/week @ 2024-09-23 233/week @ 2024-09-30 174/week @ 2024-10-07 92/week @ 2024-10-14 26/week @ 2024-10-21 186/week @ 2024-10-28 45/week @ 2024-11-04 158/week @ 2024-11-11 65/week @ 2024-11-18 58/week @ 2024-11-25 426/week @ 2024-12-02 120/week @ 2024-12-09 41/week @ 2024-12-16

661 downloads per month
Used in 27 crates (17 directly)

Apache-2.0

21KB
343 lines

Structured Logging Macros

The cu29_log_derive crate provides macros like !debug to enable structured logging, allowing you to efficiently log data in a binary format.

Example Usage

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

Instead of storing the complete formatted string in a log file, this macro captures a unique identifier for the format string and parameter names, then logs the values in a compact bincode format. This approach significantly improves logging efficiency.

Integration with Copper

If you are using this crate as part of a Copper project, no additional setup is required. The logs will automatically integrate with the Unified Logger (cu29_unifiedlog), storing logs in the binary format.

Standalone Usage

For those using this crate independently of Copper, follow the example setup provided in cu_standalone_structlog to configure your logger.

Extracting Logs

You can extract and view your logs using either Rust or Python:

  • Rust: Refer to the cu29_export module.
  • Python: Use the provided script in readlog.py for Python support.

Dependencies

~4.5–8MB
~144K SLoC