macro cu29-log-derive

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

5 releases

new 0.3.1 Oct 12, 2024
0.3.0 Sep 30, 2024
0.2.3 Sep 11, 2024
0.2.2 Aug 12, 2024
0.2.1 Jul 29, 2024
Download history 123/week @ 2024-07-26 17/week @ 2024-08-02 137/week @ 2024-08-09 32/week @ 2024-08-16 17/week @ 2024-08-23 35/week @ 2024-08-30 97/week @ 2024-09-06 49/week @ 2024-09-13 46/week @ 2024-09-20 219/week @ 2024-09-27 40/week @ 2024-10-04

394 downloads per month
Used in 15 crates (11 directly)

Apache-2.0

21KB
333 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–7MB
~146K SLoC