Skip to content

[FEAT] compile-time log-level macro#318

Merged
gbin merged 5 commits into
masterfrom
yang/feat/log_level_macro
May 12, 2025
Merged

[FEAT] compile-time log-level macro#318
gbin merged 5 commits into
masterfrom
yang/feat/log_level_macro

Conversation

@makeecat

@makeecat makeecat commented May 11, 2025

Copy link
Copy Markdown
Collaborator

This PR introduces compile-time log level filtering into the Copper logging system. The changes update the logging macros, add a log level field into CuLogEntry, adjust serialization/deserialization, and update documentation and tests accordingly.

  • Integrated compile-time log level features and updated logging macros.
  • Updated CuLogEntry to include and handle log levels in its constructor, encoding/decoding, and formatting.
  • Revised documentation and tests to reflect the new logging level functionalities.

We disable all log macro by default, the user should use related features when importing cu29 to enable specific log level.

[dependencies]
cu29 = { version = "0.7.0", features = ["log-level-debug"] }

Detailed instructions are updated in cu29_log/README.md.

@makeecat makeecat marked this pull request as draft May 11, 2025 12:14
@makeecat makeecat self-assigned this May 11, 2025
@makeecat makeecat added the enhancement New feature or request label May 11, 2025
@makeecat makeecat marked this pull request as ready for review May 11, 2025 12:21
@makeecat makeecat requested a review from Copilot May 11, 2025 12:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces compile-time log level filtering into the Copper logging system. The changes update the logging macros, add a log level field into CuLogEntry, adjust serialization/deserialization, and update documentation and tests accordingly.

  • Integrated compile-time log level features and updated logging macros.
  • Updated CuLogEntry to include and handle log levels in its constructor, encoding/decoding, and formatting.
  • Revised documentation and tests to reflect the new logging level functionalities.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
core/cu29_runtime/src/monitoring.rs Added an unused import for CuLogLevel for consistency.
core/cu29_runtime/src/log.rs Updated re-exports to include a complete set of logging macros.
core/cu29_log_runtime/src/lib.rs Modified log debug mode to convert the Copper log level to standard log level dynamically.
core/cu29_log_derive/src/lib.rs Refactored logging macro implementations to incorporate the new log level and empty macros.
core/cu29_log_derive/Cargo.toml Added feature flags for compile-time log level selections.
core/cu29_log/src/lib.rs Integrated log level support into CuLogEntry including serialization, formatting, and tests.
core/cu29_log/README.md Updated documentation to detail the new compile-time log level selection and macros usage.
core/cu29_helpers/tests/end2end.rs Adjusted tests to use the updated CuLogEntry constructor with log level.
core/cu29_export/src/lib.rs Updated test invocations to pass the log level as required by the new constructor.
core/cu29/Cargo.toml Added feature mapping for compile-time log level filtering.

Comment thread core/cu29_log_runtime/src/lib.rs
Comment thread core/cu29_log/src/lib.rs
@makeecat makeecat requested a review from gbin May 11, 2025 14:12
makeecat and others added 2 commits May 11, 2025 21:34

@gbin gbin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep I think that works! Let's merge it

@gbin gbin merged commit b4d65ca into master May 12, 2025
9 checks passed
@gbin gbin deleted the yang/feat/log_level_macro branch May 12, 2025 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants