cu29-log-derive

Crates.iocu29-log-derive
lib.rscu29-log-derive
version0.4.0
sourcesrc
created_at2024-07-29 18:30:56.153112
updated_at2024-10-29 05:06:42.534393
descriptionThis is part of the text logging macros Copper. It cannot be used independently from the copper project.
homepagehttps://github.com/copper-project
repositoryhttps://github.com/copper-project/copper-rs
max_upload_size
id1319099
size12,181
Guillaume Binet (gbin)

documentation

https://docs.rs/cu29-log-derive

README

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.
Commit count: 389

cargo fmt