log: mw_log_fmt_macro implementation#14
Conversation
License Check Results🚀 The license check job ran with the Bazel command: bazel run //:license-checkStatus: Click to expand output |
|
The created documentation from the pull request is available at: docu-html |
d6c0599 to
8992014
Compare
mw_log_macro implementationmw_log_fmt_macro implementation
There was a problem hiding this comment.
Pull request overview
This PR implements the mw_log_fmt_macro crate, providing a custom replacement for Rust's format_args! macro. The implementation includes comprehensive unit tests and removes placeholder code from the log library.
Key changes:
- Implements format string parsing with support for placeholders, format specifications, and argument handling
- Adds comprehensive test coverage for macro functionality and format specifications
- Updates documentation to reflect the correct crate naming (
mw_log_fmt_macro)
Reviewed changes
Copilot reviewed 25 out of 26 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/log/mw_log_fmt_macro/format_args.rs | Core macro implementation with format string parsing and code generation logic |
| src/log/mw_log_fmt_macro/lib.rs | Public proc macro interface exposing mw_log_format_args! and mw_log_format_args_nl! |
| src/log/mw_log_fmt_macro/tests/test_format_args.rs | Comprehensive unit tests for macro functionality |
| src/log/mw_log_fmt/*.rs | Supporting formatting library files with traits, builders, and implementations |
| docs/**/*.puml | Documentation updates to use correct crate name mw_log_fmt_macro |
| src/log/src/lib.rs | Removed placeholder code |
| Cargo.toml | Updated workspace configuration with new crates |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
8992014 to
c65d6e3
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 25 out of 26 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| for arg in args.iter() { | ||
| let (arg_expr, alias_expr) = match arg { | ||
| Expr::Assign(expr_assign) => (expr_assign.left.as_ref().clone(), Some(expr_assign.right.as_ref().clone())), | ||
| Expr::Lit(_) | Expr::Field(_) | Expr::If(_) | Expr::Path(_) | Expr::Unary(_) => (arg.clone(), None), |
There was a problem hiding this comment.
The same expression type matching pattern appears on lines 466 and 519. Consider extracting this into a helper function or constant to reduce duplication and ensure consistency if the list of allowed types needs to be updated.
| use crate::fmt_spec::FormatSpec; | ||
| use std::path::{Path, PathBuf}; | ||
|
|
||
| // TODO: replace with `core::char::MAX_LEN_UTF8` once stable. |
There was a problem hiding this comment.
Consider adding a tracking link or issue number to the TODO comment so maintainers can easily determine when core::char::MAX_LEN_UTF8 becomes stable and this workaround can be removed.
| // TODO: replace with `core::char::MAX_LEN_UTF8` once stable. | |
| // TODO: replace with `core::char::MAX_LEN_UTF8` once stable. Tracking: https://github.com/rust-lang/rust/issues/56345 |
0ad8eea to
9d1a8c6
Compare
awillenbuecher-xq-tec
left a comment
There was a problem hiding this comment.
The code base seems to be wrongly formatted, cargo fmt --check shows a lot of differences for me.
|
@awillenbuecher-xq-tec |
25ab826 to
b650ed5
Compare
b650ed5 to
80834c8
Compare
2bf9080 to
7dd13ef
Compare
7dd13ef to
ee5f163
Compare
pawelrutkaq
left a comment
There was a problem hiding this comment.
overall q: do we need to add tests for macro code generators using some specilzied crate for that ?
|
@pawelrutkaq |
|
@pawelrutkaq @arkjedrz It might make sense to test the proc-macro directly by checking that the generated code (or more precisely, the generated token stream) exactly matches an expected code/token stream. However, I would only add these tests once the implementation is pretty much finished, because any change in the proc-macro would require wide changes in the tests. |
|
Lets create ticket for proc-macoe testing as improvmenets later for now. |
ee5f163 to
f4494ac
Compare
|
Ticket for tests for proc-macro: #43 |
f4494ac to
e250c50
Compare
- Replacement for `format_args!` macro. - Replacement for `Debug` derive macro. - Unit tests.
e250c50 to
a9b44fa
Compare
format_args!macro.Debugderive macro.Notes for Reviewer
Pre-Review Checklist for the PR Author
Checklist for the PR Reviewer
Post-review Checklist for the PR Author
References
Closes #24