feat(logger): Add copy and move constructors. Fix bug in include_time config.#434
feat(logger): Add copy and move constructors. Fix bug in include_time config.#434
include_time config.#434Conversation
* Update `logger` to have `copy` and `move` constructors * Update `logger` to fix bug in which the `include_time` member of the Config was not being used / saved in constructor * Update `logger/example` to test `include_time` as well as the new `copy` and `move` constructors` Allows loggers and base components to be copied / moved, enabling richer programming and more varied use cases. Build and run `logger/example` on QtPy ESP32s3
|
✅Static analysis result - no issues found! ✅ |
There was a problem hiding this comment.
Pull Request Overview
This PR adds copy and move constructors to the logger component, fixes a bug where the logger constructor did not honor the include_time configuration, and updates the example to test the new constructor behaviors.
- Introduced copy and move constructors and updated member initialization.
- Fixed the logger constructor to correctly use Config::include_time.
- Enhanced logger examples to demonstrate copy/move functionality.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| components/logger/include/logger_formatters.hpp | Added custom fmt::formatter specialization for Verbosity enum. |
| components/logger/include/logger.hpp | Added copy/move constructors and fixed include_time usage. |
| components/logger/example/main/logger_example.cpp | Updated examples to cover copy/move constructors. |
There was a problem hiding this comment.
Pull Request Overview
This PR adds copy and move constructors to the logger component while fixing a bug where the logger constructor ignored the Config::include_time flag. Additionally, the logger example has been updated to demonstrate and test the new copy/move behaviors.
- Added copy and move constructors in logger.hpp.
- Fixed the logger constructor to properly set include_time.
- Updated logger example to test copy/move operations.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| components/logger/include/logger_formatters.hpp | Added a formatter specialization for Logger::Verbosity |
| components/logger/include/logger.hpp | Implemented and updated copy/move constructors and include_time fix |
| components/logger/example/main/logger_example.cpp | Added examples testing the new logger constructors |
Description
copyandmoveconstructors tologgercomponentConfig::include_timememberlogger/exampleto testinclude_timeconstructor as well as to test new copy/move constructorsMotivation and Context
Allows loggers and base components to be copied / moved, enabling richer programming and more varied use cases.
How has this been tested?
Build and run
logger/exampleon QtPy ESP32s3Screenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):
Types of changes
Checklist:
Software
.github/workflows/build.ymlfile to add my new test to the automated cloud build github action.